Preheat your oven to 375°F (190°C).
Grease a baking dish with butter.
Layer half of the sliced potatoes in the dish.
In a saucepan, heat the heavy cream and garlic until warm.
Season the cream mixture with salt, pepper, and thyme.
Pour half of the cream mixture over the potatoes.
Sprinkle half of the Gruyère and cheddar cheese on top.
Add the remaining potatoes, followed by the rest of the cream mixture.
Top with the remaining cheese and dot with butter.
Bake in the preheated oven for 45-60 minutes, until golden and bubbly.