Roll the pastry out on a lightly floured surface until a little larger than a buttered 24 cm (9½ inch) fluted loose-bottomed tart tin. Lift the pastry over a rolling pin, drape into the tin, then press over the base and sides. Trim off the excess pastry with scissors so that it stands a little above the top of the tin. Chill for 15 minutes.
Meanwhile, heat the oil in a frying pan, add the onion and fry until softened. Add the beetroot and cook for 2–3 minutes. Beat the eggs, milk and mustard together in a bowl. Add the onions, some of the thyme leaves torn from the stems and a generous amount of salt and cayenne pepper. Leave to stand for 5 minutes.
Put the tart case on a baking sheet and pour the beetroot mix into the tart case. Cut the cheese into 6 thick slices, arrange in a ring on top of the tart and sprinkle with the remaining thyme leaves and a little salt and cayenne pepper.
Bake in a preheated oven, 180°C (350°F), Gas Mark 4, for 40–45 minutes until the filling is set. Leave to cool for 15 minutes, then remove the tin and transfer to a plate. Serve warm or cold, cut into wedges, with salad.