In a large frypan, saute onions the in oil over medium heat until softened. Add the chicken and cook until browned on all sides. Add the mushrooms and cook until soft . Stir in the thyme and flour and then add the wine. Dissolve the stock cube in water, and stir into the chicken and vegetables. Simmer uncovered for 15 minutes, then season to taste.
Transfer mixture into a deep pie dish, or a 2 litre baking dish and set aside. Keep any excess sauce for gravy.
Preheat the oven to 220 degrees C. Grease the edges of the pie plate/baking dish.
Roll out the puff pastry a little if needed and lie it down on top of the filling. Seal the edges well; trim and crimp the edge. Brush pastry with beaten egg, and make a small hole in the centre of the top. Use any the pastry trimmings to make leaves; arrange on top of the pie. Brush pastry leaves with egg.
Bake in preheated oven for 45 minutes, or until crisp and golden.