Preheat your oven to 375°F (190°C).
In a large frying pan, heat the olive oil and butter over medium heat.
Add the sliced onions, salt, and sugar to the pan. Cook, stirring frequently, for about 25-30 minutes, until the onions are deeply caramelized and golden brown. Add minced garlic in the last 2 minutes of cooking. Remove from heat and allow to cool slightly.
Roll out the puff pastry on a lightly floured surface to fit your baking dish. Press the pastry into the dish and trim the edges. Prick the base with a fork to prevent it from puffing up.
In a mixing bowl, whisk together the eggs, heavy cream, thyme, salt, and black pepper.
Once the onions have cooled slightly, spread them evenly over the pastry crust. Pour the egg and cream mixture over the onions.
Sprinkle the Gruyère and Parmesan cheeses on top.
Bake the tart in the preheated oven for about 30-35 minutes, or until the cheese is golden and the filling is set.
Remove from the oven and let it cool for a few minutes before slicing and serving.