Heat the butter and olive oil in a large skillet over medium heat until the butter melts.
Add the sliced onions, brown sugar, salt, and black pepper. Cook, stirring often, for 20 to 25 minutes until the onions turn deep golden and soft.
Stir in the thyme leaves and remove the skillet from the heat. Let the onion mixture cool for 5 minutes.
Heat the oven to 400°F and line a baking sheet with parchment paper.
Unroll the puff pastry on a lightly floured surface and cut it into 8 equal squares. Place the squares on the prepared baking sheet.
Spoon the caramelized onions evenly onto the center of each pastry square, leaving a small border around the edges.
Top the onions with the grated Gruyère cheese.
Bake for 15 to 18 minutes until the pastry is golden and the cheese has melted. Serve warm.