2) Brush a 23x33x5cm baking dish with olive oil. In a medium saute pan, heat 2 tablespoons of olive oil and cook the onions over medium-low heat for 8 to 10 minutes, until translucent. Add the garlic and cook for another minute. Spread the onion mixture on the bottom of the baking dish.
3) Slice the potatoes, courgette and tomatoes into 1/2cm thick slices. Layer them alternately in the dish on top of the onions, fitting them tightly, making only one layer. Sprinkle with the salt, pepper, thyme leaves and thyme sprigs and drizzle with 1 more tablespoon of olive oil.
4) Cover the dish with aluminium foil and bake for 35 to 40 minutes, until the potatoes are tender. Uncover the dish, remove the thyme sprigs, sprinkle the cheese on top, and bake for another 30 minutes until browned.