Melt 1 tbsp of butter in a large saucepan over medium heat, and once melted, add the onions, stirring well. Allow the onions to cook, stirring often to prevent burning. Remove from heat after about 15-20 minutes once the onions have begun to caramelize and brown.
Using a rolling pin, roll out the sheet of puff pastry slightly. Slice into 9 equal square pieces. Preheat the oven to 400 degrees.
In a medium bowl, combine the caramelized onions, chopped mushrooms, thyme and shredded cheese, mixing well. In a smaller bowl, whisk together the eggs, milk, salt and pepper.
Lightly grease the muffin tin, then press the puff pastry squares into the tin. Fill each of the pastry cups about three-quarters full with the onion and mushroom mixture. Pour the egg mixture in until it reaches the top of the filling.
Bake for about 25 minutes, or until the puff pastry turns golden brown and the eggs are cooked through in the center.
Serve immediately, or store the extras in an airtight container in the fridge for 3-4 days. You can reheat them in the oven or air fryer!