Heat the oven to 400°F and lightly grease a 9x13" baking dish.
Using a mandolin or sharp knife, slice the potatoes as thinly as possible (about 1/16th of an inch).
Shred the parmesan and gruyere cheeses and then set aside about half for topping.
In a large pot over medium heat, melt the butter with the garlic until aromatic.
Stir in the flour to create a roux, and let cook for 1-2 minutes. Then slowly stir in the heavy cream and continue to stir until thickened, about 5 minutes.
Stir in half of the shredded parmesan and gruyere cheese. Then add in the fresh thyme, salt, and pepper and stir until combined and smooth.
Remove from the heat and let cool slightly.
Add the sliced potatoes to a large bowl and pour the sauce over top. Gently toss to coat the potatoes in the sauce.
Stack the potato slices and arrange them upright in the greased baking dish. Pour any leftover sauce over the potatoes.
Tent with aluminum foil and bake at 400°F for 60 minutes.
Then remove the foil and sprinkle with the remaining shredded cheese and continue to bake uncovered for another 20-30 minutes or until the potatoes are golden brown and cooked through.
Remove from the oven and let cool for about 10 minutes before serving.