Sift the flour into a bowl and rub in half the butter until it resembles breadcrumbs. Add 2/3 of the parmesan. Beat the egg yolk with 2 tbsp of water and add to mixture to form a soft dough. Wrap in clingfilm and place in fridge for 20 minutes.
Heat oven to 190°C.
Melt the remaining butter in a frying pan and fry the leeks, potato and thyme for 10 minutes.
Add wine and stock and bring to the boil. Boil rapidly until the liquid is reduced by 50%.Add the cream and bring to the boil and boil rapidly until the sauce resembles thick cream,.
Place mix in a large pie dish and scatter with the cheese.
Roll the pastry into a circle large enough to cover the pie dish. Brush the rim with a little water and cover the pie. Trim any excess and make decorations if you wish.
Brush the pastry with the egg.
Scatter the pie with the remaining parmesan and black pepper.