Mix the butter into the flour and salt in a bowl using your fingertips until it resembles breadcrumbs, then add the egg and mix to form a dough.Bring the dough together with your hands, adding the thyme leaves, and shape into a round. Cling film the pastry and rest in the fridge for 30 minutes.
Melt the butter in a pan over a low-medium heat, add the leeks and bay leaves and cook for 15 minutes until really soft and sweet. Allow to cool a little.
Preheat the oven to 200°C/Fan 180°C/Gas 6. Beat the eggs in a bowl, then scoop out a couple of tablespoons of beaten egg to glaze later. Add the sour cream, thyme leaves and nutmeg to the bowl. Stir in the leeks and season to taste.
Remove the pastry from the fridge and roll out to a circle about 3mm thick, leaving no gaps or holes. Place a sheet of baking paper on a baking sheet, and put the circle of pastry onto it. Spoon the creamy leeks on top, spreading it out evenly and leaving a 1–2cm gap around the edge.
Fold the edge of the pastry over to create a lip. Nudge the bay leaves to the top. Glaze all exposed pastry with the reserved egg and sprinkle the cheese over the top of the filling. Place the tart in the oven on a middle shelf and bake for 35–40 minutes until the pastry is crisp and pale golden and the tart filling is set. Remove from the oven and leave to cool for 5 or so minutes before cutting into wedges to serve.