In a frying pan over a medium heat, warm the oil and add the onion. Cook and stir until soft, about 4 to 6 minutes. Add the diced chicken and brown, then add the mushroom and leeks. Cook until the mushroom and leeks are soft and the chicken is no longer pink in the centre then season with salt, pepper and thyme as desired.
Sprinkle the flour over and stir to coat the chicken and vegetables. Gradually add in the stock, stirring constantly to help thicken to a sauce.
Pour the filling into a casserole or pie dish and top with the pastry, crimp the edges and make two small holes for the steam to escape. You can egg wash at this point, if you want to.
Bake in the preheated oven for 20 to 30 minutes until the pastry has puffed up and browned. Remove from the oven and serve immediately.