01 - Preheat the oven to 400°F. Roll the puff pastry out on a floured surface to fit a 9-inch tart pan. Press the pastry into the pan, trim the excess, and prick the base with a fork. Refrigerate while preparing the filling.
02 - In a large skillet, melt the butter with the olive oil over medium heat. Add sliced onions, sugar, salt, and black pepper. Cook, stirring frequently, until onions are soft and deep golden brown, about 25 to 30 minutes. Stir in thyme during the last 5 minutes of cooking. Allow to cool slightly.
03 - In a mixing bowl, whisk together the eggs, heavy cream, nutmeg, and a pinch of salt and pepper until smooth.
04 - Evenly distribute the caramelized onions over the chilled pastry. Sprinkle grated Gruyere cheese over the onions. Carefully pour the egg and cream mixture over the top, making sure the filling is spread evenly.
05 - Place the tart in the oven and bake for 30 to 35 minutes, until the crust is golden and the filling is set. Remove from the oven and let cool for 10 minutes before slicing.
06 - Slice and serve warm or at room temperature.