Place a large frying pan over a medium heat and, when it’s hot, add 2 tablespoons of olive oil. Allow to warm for half a minute before adding the sliced red onions so that they sizzle.
Cook the onions for 5-10 minutes resisting the urge to move them too much in the pan, allowing them to caramelise and catch on the bottom to develop some flavour. Once soft and browning, add the sugar – you can add more if you think it needs it and you can also swap the sugar for 2 tablespoons of maple syrup if preferred.
Let the onions caramelise with the sugar and, once really golden and glistening about 15 minutes later, add the chopped up tomatoes.
Season with salt and a touch of pepper before adding the balsamic vinegar and allowing everything to cook down and the tomatoes to release a lot of their water. Try a tomato to check the seasoning then set aside to cool slightly. Preheat your oven to 200°C/400°F/gas mark 6.
Take a baking sheet or oven dish roughly the same size as the filo sheets and grease this well with oil. Keep the filo covered in a tea towel or its packaging while doing the next stage as it will start to dry out – you’ll have to work quite quickly
Layer 1 or 2 sheets of filo onto the tray and using your fingers or a pastry brush, oil the edges and add another sheet of filo. Repeat the process by oiling it slightly along the edges and corners and building your filo layers, sticking them together with the olive oil.
Make sure any overhanging edges are well oiled. You can fold some of the layers over each other to create a crispy crust but think of it as 5-6 layers maximum otherwise you’ll have a chunk of cooked pastry you won’t be able to bite through.
Once you’re happy with your oiled layers, spread the jammy onion and tomato mix all over, leaving a 2-cm/1-inch gap around the edge. Sprinkle with some fresh thyme and some roughly chopped fresh basil and a pinch of salt then pop the tray in the oven for 20-30 minutes. The timing will vary depending on your oven but you can tell it’s cooked once the tomatoes are just starting to dry on top and the pastry is brown and crispy.
Slice and serve warm or leave to cool and serve with cold salads as part of an end of summer feast.