Melt the butter in a medium frying pan over a moderate heat. Add the onion, season generously with a big pinch of salt and black pepper, and cook for 8–10 minutes, until soft and just beginning to colour. Remove from the heat and stir in the thyme.
Lightly flour a work surface and roll out the pastry to rough circle about 3mm (1/8 in) thick and 30cm (12in) diameter. Transfer to a baking sheet lined with baking paper and coarsely grind black pepper over the top, giving the pastry a final roll with a rolling pin to press the pepper into the dough.
Spread the cheese over the pastry, leaving a 4cm (11⁄2in) border around the edge. Add the onion mixture in an even layer, then layer on the tarragon, saving a few leaves for garnish, and courgette (zucchini), sprinkling with additional salt and pepper.
Add the tomato slices and drizzle with olive oil, sprinkle with a little extra salt, pepper and a tiny pinch of sugar to season the tomatoes. Fold the edge of the pastry over the tomatoes, leaving the centre open.
Brush the crust with the beaten egg, then chill the tart for 15 minutes or so, to rest. Meanwhile, preheat the oven to 190°C/fan 170°C/375°F/Gas 5. Bake for 40–50 minutes, or until the pastry is crisp and golden in places and the tomatoes are cooked and just beginning to colour.
Remove from the oven and allow to cool for 5 minutes before sprinkling over the reserved tarragon, slicing and serving. The tart can be quite fragile.