Preheat the oven and bake the vol-au-vent pastry shells according to the package directions until golden and crisp. Set them aside on a baking sheet.
Melt the butter in a large skillet over medium heat. Add the shallot and garlic and cook for 2 minutes until softened.
Add the sliced mushrooms to the skillet. Cook for 6 to 8 minutes, stirring occasionally, until the mushrooms release their liquid and turn golden.
Pour in the heavy cream and stir in the thyme leaves. Season with salt and pepper. Simmer for 2 minutes until the mixture thickens slightly.
Remove the skillet from the heat and stir in most of the grated Gruyère until it melts into the filling.
Spoon the warm mushroom mixture into the baked pastry shells. Sprinkle the remaining Gruyère on top and return the filled vol-au-vents to the oven for 2 minutes to melt the cheese.