In a large saute pan set over medium heat, add enough olive oil to lightly coat the bottom of the pan. When the oil is hot, add the onions and saute until translucent, but not browned, about 5 minutes. Add the garlic and cook for 1 minute, stirring. Add the tomatoes and cook until they start to give off their liquid, about 5 minutes. Add the thyme and season with salt and pepper. Add the sugar and cook until there is almost no liquid left, about 10 to 15 minutes, stirring frequently. Remove from the heat.
Preheat the oven to 450 degrees F.
Lay the eggplant and zucchini out on a flat surface and season with salt and pepper. Drizzle with olive oil.
In another large saute pan set over medium high heat, add enough olive oil to coat the bottom of the pan. When the oil just starts to smoke, add the eggplant in 1 layer and cook just until golden brown on both sides, about 2 to 3 minutes per side. You might need to do this in batches. Remove to a paper towel lined plate. Blot the top with additional paper towels.
In the same pan, add more olive oil to coat the bottom of the pan. When the oil just starts to smoke, add the zucchini in 1 layer and saute until just browned on each side, about 1 minute per side. Remove to a paper towel lined plate.
In a shallow roasting pan or baking dish, spread half of the tomato sauce evenly over the bottom. Begin layering the eggplant and zucchini along the outside of the baking dish so they are overlapping slightly. Continue until the pan is full and the eggplant and zucchini is used. Cover the top with the remaining tomato sauce, spreading evenly. Sprinkle the mozzarella and Parmesan evenly over the top, covering completely.
Place the baking dish inside a large baking dish. Pour hot water into the larger baking dish about half way up the sides to make a water bath. Bake for 25 minutes, or until the cheese is golden brown and bubbly. Remove from the oven and let sit for 5 minutes before serving.