Make the pastry: rub the butter into the flour and salt until it looks like breadcrumbs, then add the water and bring together into a dough. Wrap and chill for 30 minutes.
Melt the butter with the oil in a large frying pan. Add the onions and a pinch of salt and cook gently for 15 to 20 minutes until soft and lightly golden. Leave to cool completely.
Heat the oven to 200C (180C fan, gas mark 6) with a baking tray inside. Roll out two thirds of the pastry and line a 23cm pie tin.
Mix the cooled onions with the cheese, cream, one egg and the mustard, season with black pepper and spoon into the pastry case.
Roll out the remaining pastry, brush the rim with beaten egg, cover the pie and press the edges together. Trim, crimp and cut a steam hole.
Brush the top with beaten egg and bake on the hot tray for 35 to 40 minutes until deep golden. Rest for 10 minutes before slicing.