1. Preheat the oven to 180 degrees Celsius (350 degrees Fahrenheit).
2. Mix the shallots with the balsamic vinegar and drizzle with olive oil, salt, and pepper. Bake in the preheated oven for 20 minutes and let cool slightly.
3. Heat the butter in a saucepan and add the sugar. Deglaze with the water and let it reduce over medium heat until caramelized, turning a light brown.
4. Increase the oven to 200 degrees Celsius (400 degrees Fahrenheit).
5. Line a quiche pan with parchment paper, pour the warm caramel into the base, and scatter the fresh thyme sprigs over it. Then arrange the shallots, flat sides down, over the base, followed by the tomatoes. Cover with the puff pastry, pressing firmly around the edges. Make a hole in the center to allow the liquid to escape, and bake in the preheated oven for 25 minutes.
6. Let cool for a few minutes, then invert onto a plate. Spread the ricotta over the top and garnish with extra fresh thyme.