Preheat oven to 180°C / 375°F.
Heat the olive oil in a shallow cast-iron pan over medium-low heat. Add the onion and garlic, then add the tomatoes and bell pepper.
Stir-fry all the vegetables for 5 minutes, then add in the sugar, balsamic vinegar, thyme and oregano. Mix all the ingredients together and gently crush the tomatoes with a wooden spoon.
Cook for about 15 minutes, stirring occasionally, then season with salt and pepper to taste.
Transfer the sauce into a food processor and blend until creamy but still a bit chunky. Add a splash of boiling water if necessary.
Spread about 1 cup of the tomato sauce evenly over the bottom of your shallow cast-iron pan.
Arrange one slice of each vegetable (courgette, aubergine, tomato, onion) on the pan and continue until the pan is full. To make things easier, stack the veggie slices in your hand then layer them into the pan.
Season with a pinch of oregano, sea salt and black pepper on top, and finish off with a swirl of olive oil.
Bake for 30 minutes in the oven, checking after 20 minutes if the veggies are tender and the sauce is gently bubbling on the sides.
Remove the pan from the oven, allow to cool for 5 minutes, then serve.