Step 1Heat the oven to 350 degrees. Grease a 9-by-13-inch baking dish with 1 tablespoon of the oil; set aside.
Step 2Heat 3 tablespoons of the remaining oil in a large, deep skillet over medium-high heat. Add the vinegar, garlic, onions, one-half teaspoon salt and one-eighth teaspoon pepper and cook, stirring occasionally, until softened and golden, about 10 minutes.
Step 3Add the basil, tomatoes and corn and cook until the tomatoes have released their liquid, 6 to 8 minutes. With a slotted spoon, transfer the tomato-corn mixture to prepared baking dish.
Step 4Return the skillet to the stove and add the remaining 3 tablespoons of oil, the squash, one-half teaspoon salt and one-eighth teaspoon pepper and cook, stirring occasionally, until softened and just golden-brown in parts, 12 to 14 minutes. Meanwhile, in a medium bowl, toss the breadcrumbs with 2 tablespoons of the lemon juice, butter, herbs, one-fourth teaspoon salt and a pinch of pepper, just until combined.
Step 5Transfer the squash to the dish with the tomato-corn mix. Add the Gruyere, sour cream (in dollops), and the remaining 2 tablespoons lemon juice and half of the breadcrumbs and toss together gently to combine. Top with the remaining breadcrumbs; bake until golden brown and bubbling, about 45 minutes. Serve immediately.