01 - Set the oven to 400°F (200°C) to ensure even baking.
02 - Roll out the puff pastry and line a 9-inch tart pan. Trim any excess and prick the base repeatedly with a fork. Chill in the refrigerator until ready.
03 - Heat olive oil and unsalted butter in a large skillet over medium heat. Add thinly sliced onions and cook, stirring occasionally, until they become soft and golden brown, approximately 20 minutes.
04 - Add sliced mushrooms to the skillet and cook until their moisture evaporates and they begin to brown, about 8 minutes. Stir in minced garlic and thyme, cooking for an additional minute.
05 - Pour in the balsamic vinegar to deglaze the pan, scraping up any browned bits. Season the mixture with kosher salt and freshly ground black pepper, then remove from heat and allow to cool slightly.
06 - In a mixing bowl, whisk together the eggs and heavy cream until smooth. Fold in half of the grated Gruyère cheese.
07 - Evenly distribute the onion and mushroom mixture over the chilled pastry base. Pour the egg and cheese custard over the filling, then sprinkle the remaining Gruyère cheese atop.
08 - Place the tart in the preheated oven and bake for 30 to 35 minutes, or until the crust is golden and the filling is set.
09 - Allow the tart to cool slightly before slicing. Garnish with fresh thyme sprigs if desired. Serve warm or at room temperature.