Grease the pie tin with butter, or with a neutral oil and a pastry brush, and set aside.
To make the pastry, add cold butter to flour and salt and rub in between fingers. Or use a food processor. (I run my wrists and hands under cold water to cool them down first). Rub the butter, flour and salt until they resemble breadcrumbs; some small, some the size of peas.
Separate the egg and reserve the white, pour the yolk into a well in the centre of the mixture. Keep mixing and add very cold water, tablespoon by tablespoon, until it just comes together in a ball. If using a food processor, do this part by hand.
Tip the pastry onto a piece of cling film and use the cling film to bring it together into a disk. Refrigerate for at least 30 minutes.
While the pastry is chilling, use this time to prep the filling ingredients. Melt a knob of butter with a small amount of olive oil in a frying pan and sweat the shallots on a low/medium heat until soft and caramelised, this should take 10-12 minutes. In another pan, fry the bacon until crispy, then remove, leaving the bacon fat in the pan.
Using a tablespoon of the reserved fat (remove and save any surplus for another recipe), sauté the asparagus with a pinch of salt and pepper for 3 minutes until softened but still crisp.
Dust a work surface with flour and roll the pastry into 0.5cm/ ¼ inch thick. Roll the pastry up over the rolling pin, place the pan in front and unroll the pastry on top.
Lift and drop the pastry into the edges of the tin, don’t push and stretch the pastry as this will create tears. A ball of leftover pastry can be used to help mould the pastry into the edges. Trim the edges of the pastry and crimp if desired. Chill in the fridge again for at least 30mins. During this time, preheat the oven to 200C/gas 6. Add a baking sheet to the oven at this point, giving it time to heat up. Rest the pie dish on this while cooking to prevent the base from becoming soggy.
Once chilled, prick the bottom of the pastry all over with a fork, then fill with baking beans or a suitable alternative. Place on the preheated baking tray and bake for 20 minutes. Take out of the oven and remove the baking beans. Take the reserved egg white and using a pastry brush, lightly coat the inside of the pastry shell and bake for an additional 5-7 minutes, just until the pastry no longer looks wet, but not allowing the edges of the crust to brown too much. Adding an egg wash barrier between the custard and the pastry helps to prevent the custard from leaking.
Reduce the oven to 180C/gas 4.
Allow the pastry to cool slightly while you make the custard. Whisk the eggs, nutmeg and cream together with a generous pinch of salt and pepper.
Evenly spread the bacon, shallots and ¾ of gruyère over the base of the pastry. Pour the custard over and sprinkle with the remaining gruyère and thyme. Bake for 15 minutes, or until somewhat set. Alternatively, place the pie tin in the oven without the custard and pour the custard over inside the oven to avoid spillages, cover with cheese and thyme as normal.
After 15 minutes, remove from the oven and arrange the asparagus on top. Place them with the tips all facing outwards, like the points on a clock. Place back into the oven for an additional 7 minutes, or until the filling is softly set.
Allow to set for 10 minutes before removing from the tin.