In a large, wide pot, heat 3 tablespoons of the olive oil over medium heat.
Add the onions, fennel, garlic, thyme sprigs, and a pinch of salt.
Cook until the vegetables are golden, soft, and sweet, about 30 minutes.
Remove the thyme sprigs.
Trim the ends of the eggplant, peel it, and slice crosswise 1/4 to 1/3 inch thick.
Trim the ends of the zucchini and slice on the diagonal as thickly as the eggplant.
Place the eggplant slices on a heavy baking sheet.
Sprinkle both sides with salt, using a total of 1 tablespoon.
Let rest for about 20 minutes to draw out moisture.
With paper towels, blot the eggplant on both sides.
In a bowl, combine the cheese, bread crumbs, basil, parsley, scallions, chopped thyme, salt to taste, and several grinds of pepper.
Mix well with your hands.
Preheat the oven to 400F.
In a 16 by 10-inch oval gratin dish, or a shallow baking dish of similar capacity, spread the fennel-onion mixture in an even layer.
Sprinkle with one-quarter of the bread crumb mixture.
Top with half of the eggplant slices, overlapping them slightly, then with another quarter of the bread crumb mixture, the remaining eggplant slices, and another quarter of the bread crumb mixture.
For the final layer, make overlapping rows of sliced zucchini and tomatoes, pressing them firmly into place.
Season with salt and pepper.
Top with the remaining bread crumb mixture.
Drizzle with the remaining 4 tablespoons olive oil.
Bake the gratin for 1 hour, then remove from the oven, tilt the baking dish slightly and spoon some of the juices over the surface.
Return to the oven until the gratin is nicely colored on top and the zucchini are tender but not mushy, about 10 minutes longer.
The gratin is best when allowed to rest for at least 1 hour before serving.