Prepare the roasted garlic: Preheat your oven to 400°F (200°C). Cut the tops off the garlic heads to expose the cloves, place them on a small piece of foil, drizzle with olive oil, and wrap tightly. Roast for 35-40 minutes until the garlic is soft and golden. Let cool slightly before squeezing the softened cloves into a small bowl.
Reduce oven temperature to 350°F (175°C) and grease a 9×13 inch baking dish.
Prepare the cream mixture: In a medium saucepan over medium heat, combine heavy cream, milk, butter, roasted garlic paste, thyme, rosemary, 1 teaspoon of salt, black pepper, and nutmeg. Bring to a gentle simmer, stirring occasionally to prevent scorching. Remove from heat once it starts bubbling around the edges.
Prepare the potatoes: Thinly slice the potatoes (a mandoline is ideal for even slices) and place in a large bowl. Sprinkle with the remaining teaspoon of salt and toss gently to coat.
Create the first layer: Arrange one-third of the potato slices in an overlapping pattern in the prepared baking dish. Pour approximately one-third of the cream mixture over them, then sprinkle with one-third of each cheese.
Repeat the layering process twice more with the remaining potatoes, cream mixture, and cheeses, finishing with a generous cheese layer on top.
Cover and bake with aluminum foil for 45 minutes, then remove the foil and bake for an additional 25-30 minutes until the potatoes are fork-tender and the top is bubbling and golden brown.
Rest before serving: Allow the gratin to rest for 15 minutes before serving. This crucial step helps the layers set and allows the flavors to meld together perfectly. Garnish with fresh parsley before serving.