01 - Preheat oven to 400°F. Line a baking sheet with parchment paper.
02 - Heat olive oil in a skillet over medium heat. Add onions and garlic and sauté until translucent, approximately 2 minutes.
03 - Stir in mushrooms and cook until softened and any released liquid has evaporated, about 5 minutes.
04 - Add chopped spinach to the pan and cook until wilted, around 2 minutes. Remove skillet from heat and allow the mixture to cool slightly.
05 - Transfer vegetable mixture to a bowl. Mix in ricotta cheese, Parmesan cheese, dried thyme, salt, and black pepper until thoroughly combined.
06 - Unroll the thawed puff pastry on a lightly floured surface and cut into 8 even squares.
07 - Spoon a generous portion of filling onto the center of each pastry square. Fold each piece into a triangle or rectangle and pinch edges to seal firmly.
08 - Place each filled pastry on the prepared baking sheet. Brush the tops with beaten egg for a glossy finish.
09 - Bake in the preheated oven for 20 to 25 minutes, or until pastries are golden and puffed.
10 - Allow pastries to cool for a few minutes on the baking sheet before serving warm.