Preheat the oven to 350° F
Caramelize the Onions
Heat 1 Tbsp of the butter and the olive oil in a 10-inch skillet over medium heat.
Add the onions and cook without stirring until beginning to brown (~ 5 to 7 minutes). Sprinkle with a strong pinch of sea salt and freshly ground black pepper
Reduce the heat to low and continue to cook, stirring and scraping the bottom of the pan frequently with a wooden spoon and spreading the onions evenly over the bottom of the skillet, until golden brown (~ 30 to 40 minutes)
Add 1 Tbsp water at a time if the onions begin to stick to the skillet.
Set aside to cool
Assemble and Bake the Gratin
Peel the potatoes. Using a mandoline or sharp knife, slice the potatoes into thin rounds (about 1/16 inch thick).
Spread about one-third of the potatoes in the bottom of a 3-quart baking dish. Sprinkle with sea salt, freshly ground black pepper and half of the thyme.
Scatter half of the caramelized onions evenly over the potatoes, and top with one-third of the cheese.
Make a second layer with half of the remaining potatoes.
Sprinkle with sea salt and freshly ground black pepper, and top with the remaining thyme and onions.
Top with one-third of the cheese.
Top with a third and final layer of potatoes.
In a 2-quart saucepan, bring the milk to a simmer. Stir in the nutmeg, and then pour the hot milk evenly over the potatoes.
Top with the remaining cheese.
Cut the remaining 1 Tbs. butter into small pieces and scatter on top.
Bake, until the potatoes are tender when pierced with a paring knife and the top, is golden brown (~ 1 hour to 1 ¼ hours)
Cover loosely with foil if the top begins to darken too quickly.
Let the gratin cool for 10 to 15 minutes before serving.