Preheat the oven to 375°F (190°C).
In a pan, melt butter and sauté onions and garlic until softened. Add mushrooms and cook until tender.
Stir in flour and cook for 1 minute. Slowly add chicken broth and cream, stirring to combine.
Add the shredded chicken, thyme, salt, and pepper, and cook until the sauce thickens.
Roll out puff pastry and place it in a pie dish. Add the chicken and mushroom mixture.
Cover with pastry, sealing the edges. Brush with egg wash.
Bake for 30 minutes, until golden brown.
Let cool for 10 minutes before serving.