Preheat your oven to 375°F (190°C).
In a mixing bowl, whisk together the heavy cream, milk, minced garlic, thyme, salt, black pepper, and nutmeg until well combined.
Grease the baking dish with 1 tablespoon of butter.
Layer half of the sweet potato slices in the baking dish, slightly overlapping the pieces.
Pour half of the cream mixture over the first layer of sweet potatoes, followed by half of the Gruyère cheese.
Repeat the layering process with the remaining sweet potatoes, cream mixture, and Gruyère cheese.
Top the final layer with grated Parmesan cheese and the remaining tablespoon of butter, cut into small pieces.
Cover the dish with aluminum foil and bake in the preheated oven for 30 minutes.
Remove the foil and bake for an additional 15 minutes, or until the top is bubbly and golden brown.
Let the gratin cool for a few minutes before serving.