Preheat your oven to 375°F (190°C).
In a frying pan, heat the olive oil and butter over medium heat. Add the sliced onions and sugar. Cook, stirring occasionally, until the onions are caramelized and golden brown, about 20 minutes.
Season the onions with salt, pepper, and thyme, then set aside to cool slightly.
Roll out the puff pastry on a lightly floured surface to fit your tart pan. Place the pastry in the tart pan, trimming any excess.
In a mixing bowl, whisk together the eggs and heavy cream. Stir in the grated Gruyère cheese, and add the cooled onions.
Pour the onion and cheese mixture into the pastry shell, spreading it evenly.
Bake the tart in the preheated oven for 30-35 minutes, or until the pastry is golden brown and the filling is set.
Allow the tart to cool slightly before slicing. Serve warm or at room temperature.