Preheat the oven to 180ºC/350ºF/gas 4. Grease a 22cm loose-bottomed tart tin with a little butter, then set side.
Sieve the flour into a large bowl, then rub in the butter with the tips of your fingers until the mixture resembles breadcrumbs. Add 6 tablespoons of cold water, stirring with a knife until it forms a rough dough. Use your hands to bring it together into a ball, then wrap in cling film and pop in the fridge for around 30 minutes to rest.
Meanwhile, make the filling. Finely slice the bacon, garlic and leeks. Add the bacon and garlic to a large pan with a splash of olive oil over a medium heat. Pick in the thyme leaves and cook for around 2 minutes, or until lightly golden, stirring occasionally. Stir in the leeks, turn the heat down to medium–low and cover. Cook for a further 20 minutes, or until softened, adding the spinach for the final minute to wilt. Tip the veg and bacon mixture into a large jug. Grate and add the Cheddar, then add the eggs, crème fraîche and a pinch of salt and pepper. Stir well, then set aside.
On a flour-dusted surface, roll out the dough to roughly ½cm thick. Carefully place into the tart tin and push it into the sides (don’t worry if it breaks – patch up any holes with spare pastry). Trim and discard the excess. Place a double layer of clingfilm on top and fill the tin with baking beans or uncooked rice. Place the tin on a baking tray, then pop in the hot oven for 10 to 12 minutes, or until lightly golden. Remove the beans and clingfilm, then return to the oven for a further 8 to 10 minutes, or until golden.
Pour the filling into the baked pastry case, then return to the oven for 10 to 15 minutes, or until the filling is almost set. Leave to cool slightly, then carefully remove the tart tin and serve alongside a crisp, green salad.