Heat your oven to 180°C/Fan 160°C/Gas 4. Strip the leaves from the thyme. Peel and thinly slice the onions. Heat 1 tbsp olive oil in a frying pan and add the onions. Season. Cook, stirring occasionally, on a very low heat for 15 mins till meltingly soft.
Add one third of the thyme leaves to the onions and ½ tbsp of the sugar. Cook for 5 mins. Remove from the heat. Cut the cherry tomatoes in half. Peel and thinly slice the garlic.
Grate the cheddar. Grate the butter into a bowl. Add the flour, reserving 1 tbsp for later. Using your fingertips, rub the butter into the flour till it resembles breadcrumbs. Stir the cheddar into the buttery flour and add half of the remaining thyme leaves. Season.
Separate the egg yolk (keep the white). Add the yolk to the bowl with 2 tbsp ice cold water and bring together to form a dough. Add more water, 1 tsp at a time, if necessary but take care not to make it too wet.
Once you have a dough, roll into a ball and pop into the fridge for 10 mins to rest. Once it has rested, dust your work surface with the 1 tbsp flour you saved earlier. Roll into a circle slightly bigger than a small, round ovenproof pan or dish. It should be the thickness of a £1 coin.
Place your ovenproof pan on the hob. Add 1 tbsp olive oil and warm on a medium heat. Add the garlic slices and remaining thyme leaves and cook for 1 min till they sizzle. Add the remaining sugar and stir. Remove from the heat.
Place the tomatoes into the pan, cut side down. If you have any extra, halve them again and place on top of the halves lining the pan. Spoon over the caramelised onions and spread evenly.
Place the pastry on top. Tuck the edges down into the sides. Brush with the egg white. Cook in the oven for 25 mins. Leave to cool for 5 mins. Flip out onto a plate. Serve with the salad.