Preheat the oven to 375°F (190°C). Grease your baking dish with butter to prevent sticking.
Peel the potatoes and slice them thinly using a mandoline or sharp knife. Aim for about 1/8-inch thickness.
In a mixing bowl, combine the heavy cream, chopped onion, minced garlic, salt, pepper, and thyme. Whisk until well combined.
Layer one-third of the sliced potatoes in the bottom of the greased baking dish. Pour one-third of the cream mixture over the potatoes, then sprinkle one-third of the cheddar cheese on top.
Repeat the layering process two more times, finishing with the remaining cream mixture and cheese on top. Finally, sprinkle the grated Parmesan cheese over the top layer.
Cover the baking dish with aluminum foil and bake in the preheated oven for 45 minutes.
Remove the foil and bake for an additional 15 minutes, or until the top is golden and bubbly, and the potatoes are tender.
Let the dish rest for about 10 minutes before serving. This allows the layers to set and makes it easier to serve.