Preheat the oven to 415°F. Line a large baking sheet with parchment paper.
Melt the butter in a large skillet over medium-high heat. Add the mushrooms and cook for 8–10 minutes, stirring occasionally, until their moisture has evaporated and they begin to brown.
Add the shallot and cook for 5-7 minutes, until softened. Stir in the thyme and salt. Add the wine and cook until the liquid has evaporated. Remove from the heat and let cool.
On a lightly floured surface, roll the pastry into a 12-by-9-inch rectangle. Cut into 12 equal 3-inch squares and place them on the prepared baking sheet, leaving about 1 inch between them.
Prick only the center of each pastry square with a fork, leaving about ¼ inch around the edges untouched. Lightly brush the borders with egg wash.
Stir ½ cup of the Gruyère into the cooled mushroom mixture. Divide the filling evenly among the pastry squares, keeping it inside the borders. Top with the remaining cheese.
Bake for 12-15 minutes, until the edges are puffed and the pastry is deeply golden. Let it cool for 5 minutes, garnish with thyme, and serve warm.