Heat the butter and add the onions and garlic. Cook, stirring, until onions are wilted, about 5 minutes. Add the mushrooms, lemon juice, salt, pepper, parsley, thyme, and basil. Cook over relatively high heat, stirring frequently, until the liquid has almost completely evaporated, 8 to 10 minutes.
Add the ham and cook, stirring, about 4 minutes. Add 6tablespoons bread crumbs and 3tablespoons Parmesan cheese.
Trim off the ends and cut each eggplant into ½-inch slices. You should have about 16 slices.
Pour the flour into a baking dish and add salt and pepper to taste. Dredge the eggplant slices in the flour mixture on both sides, shaking off the excess.
Heat about ¼cup oil in a large heavy skillet and add as many eggplant slices as the skillet will hold. Cook until golden brown on one side, 1½ to 2 minutes, adding more oil, little by little. The point is to add as much oil as necessary but as little as possible. Turn the slices, cook until golden on that side, and drain on paper towels. Continue adding eggplant slices and oil as necessary until all the slices have been cooked on both sides. The total cooking time for all the slices should be about 15 minutes.
Select a rectangular, square, or oval baking dish. (A No. 6 Pyrex glass dish that measures 11¾ × 7½ × 1¾inches works well.) Arrange the smaller slices of eggplant, sides touching, on the bottom of the dish. Spoon the filling in the center, spreading it out almost but not quite to the edges and mounding it in the center. Cover with the remaining eggplant slices, overlapping as necessary.
Blend the remaining bread crumbs and cheese and sprinkle over all.
When ready to cook, preheat the oven to 400 degrees.
Place the dish in the oven and bake35 to 40 minutes. Remove the dish and pour off the fat that will have accumulated on top and around the edges. Let cool slightly.