1. To make the pastry, pulse the flours, salt, butter, cheese and the thyme leaves in a food processor until they resemble coarse breadcrumbs. Add the water and pulse until the pastry just comes together. Shape it into a ball, wrap it in foil and flatten to a disc. Chill for 2 hours.
2. Cut a cross in the top of each tomato. Bring a large pan of water to the boil and prepare a bowl of iced water. Drop the tomatoes into the boiling water, leave them for 30 seconds or until the skins start to peel off, then drop them into the iced water. Peel the skins and cut each tomato in half vertically.
3. Scoop out the seeds with a teaspoon, place them on a plate lined with paper towels, sprinkle the cut sides with salt and turn them cut side down onto the towels. Leave for 30 minutes or so, then lightly pat dry with paper towels.
4. Preheat the oven to 220C/425F/gas 7. Prepare a shallow gratin, flan or other ovenproof dish about 23cm in diameter. Place the brown sugar, butter and balsamic vinegar in the dish and transfer to the oven for 10 minutes or until it starts bubbling; give it a stir halfway through.
5. In the meantime roll out the chilled pastry on a lightly floured surface to a round a little bigger than the dish; you will want to tuck the edges in around the tomatoes. Return the rolled out pastry to the fridge.
6. Remove the dish with the bubbling caramel from the oven. Slice the garlic thinly into the dish, place a couple of sprigs of thyme around the slices and then arrange the tomatoes tightly in the dish, cut side up. Lay the pastry disc over tomatoes and tuck in the edges.
7. Pierce holes with a sharp knife in the pastry to let the steam escape. Transfer to the oven and bake for 30 minutes, until golden and crusty. Let it stand for 10 minutes to let the juices get absorbed.
8. Run a knife around the dish to release the pastry if it stuck in places. Place a large platter over the dish and invert it swiftly onto the platter. Serve warm or at room temperature with green salad.