Preheat the oven to 350 degrees F and line a baking sheet with parchment paper. Arrange the phyllo cups on the sheet.
Melt the butter in a large skillet over medium heat. Add the shallot and garlic. Cook for 2 minutes until softened.
Add the mushrooms to the skillet. Season with salt and pepper. Cook for 5 to 6 minutes until the mushrooms release their liquid and start to brown.
Pour in the red wine. Bring to a simmer and cook for 8 to 10 minutes until most of the liquid has reduced and the mushrooms look glossy.
Stir in the thyme leaves. Remove the skillet from the heat.
Spoon the mushroom mixture evenly into the phyllo cups. Top each cup with a generous pinch of shredded Gruyère.
Bake for 8 to 10 minutes until the cheese melts and the edges of the cups turn golden.