Make the sauce: Heat the olive oil in a large skillet over medium-high heat. Add the onions and garlic and season with salt and the red pepper flakes; cook until the onions are soft and translucent, 7 to 8 minutes. Add the sugar and tomatoes and break up some of the tomatoes with a wooden spoon. Reduce the heat to medium and cook, stirring from time to time, until the tomatoes are fairly broken down, 10 to 15 minutes. Taste for seasoning. Let cool.
Prepare the eggplant: Put the eggplant rounds in a single layer on a baking sheet. Sprinkle with salt on both sides and let sit, about 1 hour. Rinse the eggplant with cold water and dry thoroughly with a kitchen towel. (Salting the eggplant draws out the liquid and bitter flavor, but it's optional: Skip this step if you don't have time.)
Put the flour in a medium bowl and season with salt and pepper. In another bowl, whisk the eggs with the milk and season with salt and pepper. In a third bowl, combine the breadcrumbs, oregano and thyme and season with salt and pepper. Dredge each eggplant slice in the flour and shake off any excess. Dip in the egg mixture and finally in the breadcrumbs, coating both sides. Lay the eggplant slices on baking sheets in a single layer.
Heat about 1/2 inch vegetable oil in a large skillet over medium-high heat until it begins to smoke lightly (between 380 degrees F and 400 degrees F). Using tongs, add a single layer of eggplant to the skillet and cook until golden brown, about 2 minutes per side. Transfer to a paper towel-lined baking sheet and season lightly with salt. Repeat until all of the eggplant is fried.
Position a rack in the upper third of the oven and preheat to 350 degrees F. Spoon about one-quarter of the tomato sauce into a 9-by-13-inch flameproof baking dish. Top with a layer of the fried eggplant, overlapping the slices slightly. Top with about one-quarter of the mozzarella, then sprinkle with about one-third each of the parmesan, provolone and basil. Repeat the layering 2 more times (sauce, eggplant, cheese, basil), then finish with the remaining sauce and mozzarella. Press the layers firmly into the dish. Bake until the cheese is melted and bubbly, 35 to 40 minutes. For an extra-brown top, put the dish under the broiler for a minute or two just before serving.