Place the eggplant in a colander and sprinkle with ½ teaspoon salt. Place in the sink or over a large rimmed plate and set aside for 20 minutes to drain. Blot dry with a clean kitchen towel or paper towels.
Heat 3 tablespoons of the olive oil in a large skillet over medium heat. Add the eggplant and cook, stirring occasionally, for 10 to 15 minutes, or until tender. Transfer to a large bowl and set aside.
Add another 1 tablespoon olive oil and the zucchini to the skillet. Cook, stirring occasionally, for 3 to 5 minutes, or until the zucchini is tender but not mushy. Season with ¼ teaspoon salt and transfer to the bowl with the eggplant.
Add another 1 tablespoon olive oil to the pan. Add the onion and pepper and cook for 5 minutes, stirring occasionally, or until softened. Stir in the garlic and ¼ teaspoon salt and cook for another 10 minutes, or until very tender. If the pan becomes dry, add more oil as needed.
Stir the remaining 1 tablespoon olive oil into the peppers and onions. Add the tomatoes, red pepper flakes, and sugar and cook for 8 to 10 minutes, or until the tomatoes break down.
Add the eggplant and zucchini back into the skillet along with the vinegar, thyme, ¼ teaspoon salt, and several grinds of pepper. Cook, stirring occasionally, for 10 to 15 minutes, or until the ratatouille is thick. Stir in the basil and season to taste. Garnish with more basil and serve.