Preheat oven to 375°. Butter a 2-quart casserole or gratin dish with 1 tablespoon butter. In a small saucepan over medium heat, melt 2 tablespoons butter. When butter stops foaming, add garlic and cook, stirring, until fragrant, about 30 seconds. (Egg free: Add flour until paste forms and cook until raw flour tast goes away, 30 seconds to a minute) . Add thyme, sage, and ½ teaspoon salt and cook, stirring occasionally, until heated through, about 30 seconds. Add cream, milk, cinnamon, and nutmeg. Bring to a simmer (do not let boil) and cook, stirring occasionally, until slightly thickened, about 5 minutes. Remove from heat.
Skip if no eggs: In a medium bowl, beat eggs. Transfer 1 cup cream mixture to a liquid measuring cup or bowl with a spout. Whisking constantly, slowly stream cream mixture into eggs a few tablespoons at a time until incorporated. Add egg mixture to saucepan with remaining cream mixture and whisk until combined.
Whisk in ½ cup Parmesan; season with pepper
Line bottom of prepared dish with a layer of potatoes, slightly overlapping slices; season with a pinch of salt. Top with ⅔ cup Gruyère and ⅔ cup cream mixture. Repeat 3 times, ending with cream mixture. Top final layer with remaining ¼ cup Parmesan.
Butter a piece of foil and tightly cover dish. Bake gratin 30 minutes, uncover, and continue to bake until sides are bubbling and golden brown, about 30 minutes more. Top with thyme.
