Put the flour and butter in a food processor and blend until the mixture resembles fine breadcrumbs. Add the egg and pulse until the mixture just comes together as a dough (add a little water if needed). Bring the dough together and flatten into a round.
Put the pastry in the centre of a 20cm/8in springform cake tin and carefully ease it over the base and up the sides of the tin, place in the fridge.
Cook the potatoes in boiling water for 15 minutes, or until just tender. Drain in a colander, tip back into the saucepan and cut into 3cm/1¼in pieces with a round-bladed knife.
Melt the butter and oil in a frying pan and fry the onions, leeks and red pepper gently for 15 minutes, or until soft and pale golden-brown. Add the garlic and cook for two further minutes, stirring regularly.
Preheat the oven to 200C/180C (fan)/Gas 6.
Add the onions, leeks, pepper and garlic to the potatoes and sprinkle with 100g/3½oz of the cheese and the parsley. Add the spinach leaves and season with nutmeg, salt and freshly ground black pepper. (add the ham if being used) Bring all the ingredients together until well combined.
Spoon the filling mixture into the pastry case. Pour over the cream and allow it to drizzle down between the layers. Sprinkle the remaining cheese on top.
Place the tin on a baking tray and bake in the oven for 40-45 minutes, or until the pastry is crisp and pale golden-brown.
Leave the pie to cool in the tin for 45 minutes. Remove the pie from the tin and place it on a serving plate. Cut into thick wedges with a sharp knife. I love this served cold too… enjoy!!