Preheat the oven to 400°. Peel and thinly slice the potatoes with a mandoline or chef's knife. Dice the onion, mince the garlic, and grate the cheese. Grease a 9x13 inch casserole dish.
Heat a saucepan on medium-low and add the butter, onions, and garlic. Sauté until soft, about 3 minutes. Cover with the flour, stir and allow to cook for 2 more minutes.
Pour in the milk, cream, salt, pepper, and thyme and allow to simmer for about 5 minutes, or until it starts to thicken. Remove from the heat and add the cheese. Stir to combine until it all melts into a cheesy sauce.
Put the sliced potatoes in a large bowl and slowly pour the cheese sauce over the top. Stir until all the potatoes are covered in the sauce. Pour this in the casserole dish, cover with aluminum foil, and bake for 30 minutes. Remove the foil and cook for an additional 25 minutes.