Preheat the oven to 200C/400F/Gas 6 and grease a 18cm/7in springform cake tin.
Heat the oil in a frying pan and fry the leeks, rosemary and thyme for 4-5 minutes, or until softened. Add the garlic and cook for another minute.
Add the mushrooms and sage and cook for 2-3 minutes, then remove from the heat, transfer to a large bowl and set aside to cool. (Reserve two tablespoon of this mixture for the gravy.)
Toast the nuts in the oven for 8-10 minutes (keep an eye on them as they burn really easily). Remove from the oven and set aside to cool.
Blend the nuts in a food processor to a coarse powder and add to the leek mixture with the cheese. Mix until well combined and season with salt and freshly ground black pepper.
Stir in the eggs until well combined.
For the pastry, heat the water and butter in a small saucepan over a medium heat until the butter melts and the mixture just boils.
Mix the flours, salt and egg together in a bowl, then add the butter mixture and mix together really quickly until combined. Shape the dough into a ball (it should be quite moist) and chill in the fridge for five minutes.
Tear off one-fifth of the pastry and set aside, then knead the remaining pastry briefly and roll out on a well-floured work surface into a 5mm/¼in thick circle.
Flour the top of the dough, fold into four, and use it to line the 18cm/7in springform cake tin. Put the folded dough into the tin with the pointed end towards the middle, then unfold the dough so that the excess falls over the side (the dough will be quite fragile). Now ease the dough into the corners of the tin. If the dough tears, squeeze it back together again, this pastry is very forgiving.
Trim the pastry, leaving a 1cm/½in border.
Spoon half of the filling into the tin, pressing it down tightly with a wooden spoon. Tip over the dried cranberries, press down a little and finish with the rest of the pie filling, pressing down well.
Brush any exposed pastry with the beaten egg.
Roll the reserved pastry into a circle, and using the cake tin as a guide, cut out a circle with a 1cm/½in border.
Place the pastry over the top of the tin and squeeze or crimp the lid onto the pie to seal it, trimming any excess. Cut a slit in the middle of the pie to let any steam escape and bake in the oven for 20-25 minutes.
Remove the pie from the oven and carefully remove the tin. Slide the pie onto a baking tray and glaze the top and sides of the pie with the beaten egg, then return to the oven for a further 15 minutes, or until golden-brown.
Remove the pie from the oven, glaze the top again and top with the frozen cranberries. Return to the oven for a further 5-10 minutes.
Meanwhile, for the gravy, melt the butter in a saucepan and add the reserved mushroom and leek mixture followed by the tomato purée. Stir on a low heat for 2 minutes, or until it changes colour to a deeper shade of brown.
Add the yeast extract, flour and rosemary then gradually add the stock. Bring to the boil, then season with salt pepper and brown sugar.
Simmer for 10-15 minutes, until thickened. (You can strain the mixture for a smooth gravy if you like.)