Brush a 9 by 13 by 2-inch 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.
Slice the potatoes, zucchini, and tomatoes in 1/4-inch thick slices. Layer them alternately in the dish on top of the onions, fitting them tightly, making only 1 layer. Sprinkle with salt, pepper, thyme leaves, and thyme sprigs and drizzle with 1 more tablespoon of olive oil. Cover the dish with aluminum 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. Serve warm.