Heat the butter in a large cast-iron or nonstick skillet over medium-high heat. Add the onion and cook, stirring, until soft and just beginning to brown at the edges, 2 to 3 minutes. Add the corn and sugar (if using) and cook, stirring occasionally, until crisp-tender, about 3minutes. Scrape the corn into a bowl and let cool for 10 minutes (wipe the skillet clean and reserve). Stir in the 2 tablespoons mayonnaise, followed by the mozzarella, fontina and parsley, and season with salt and pepper.
Brush a thin layer of mayonnaise on each slice of the sourdough bread, then turn the slices over. Divide the corn mixture among 4 slices of bread, then sandwich them with the other 4 slices. (Make sure the “mayonnaise sides” are facing outward.)
Heat the reserved skillet over medium heat. Add 2 sandwiches to the skillet, cover, and cook, flipping once, until golden brown outside and the cheese is melted inside, 8 to 10 minutes. Transfer the sandwiches to a cutting board and repeat with the remaining sandwiches.
As soon as they’re cooked, cut the sandwiches in half and eat, being careful not to burn your mouth on the molten cheese.