Preheat your oven to 350°F (175°C).
Over medium heat, in a saucepan, melt the butter. Add the minced garlic and sauté for about a minute until fragrant.
In a separate bowl, whisk together the heavy cream, salt, and pepper.
In a greased baking dish, arrange a layer of sliced potatoes, then sprinkle with a portion of the grated Gruyère cheese. Repeat this process, creating layers until all the potatoes and cheese are used up.
Pour the cream mixture evenly over the layered potatoes and cheese.
Place aluminum foil over the baking dish and bake in the preheated oven for 45 minutes.
Remove the foil and bake for an additional 30-40 minutes or until the potatoes are tender and the top is golden brown.
Garnish with fresh thyme leaves if desired.