Preheat the oven to a high temperature suitable for baking puff pastry.
Thinly slice the onions and mix them with butter, salt, pepper, and thyme.
Spread the seasoned onions evenly on a baking sheet.
Sprinkle grated Gruyère cheese over the onions.
Place a sheet of puff pastry on top of the onion and cheese mixture, pressing down gently to seal.
Bake the tart until the puff pastry turns golden and crispy.
Once baked, carefully flip the tart onto a serving platter so that the caramelized onions are on top.
Slice the tart and serve it warm as an appetizer.
