Preheat the oven to 200°C (400°F).
In a skillet, heat the olive oil and butter over medium heat. Add the sliced onions and cook, stirring frequently, for about 20-25 minutes until they are caramelized and golden brown. Add the minced garlic during the last 2 minutes of cooking.
Season the caramelized onions with salt, pepper, and thyme. Remove from heat and let it cool slightly.
Roll out the puff pastry on a lightly floured surface to fit your baking sheet. Place the rolled pastry onto the baking sheet.
Spread the caramelized onion mixture evenly over the puff pastry, leaving a border of about 1 inch around the edges.
Sprinkle the grated Gruyère cheese and crumbled goat cheese on top of the onions.
Fold the edges of the pastry over the filling to create a border, and brush the edges with the beaten egg for a golden finish.
Bake in the preheated oven for 25-30 minutes, or until the pastry is puffed up and golden brown.
Remove the tart from the oven, let it cool for a few minutes, then slice and serve warm.