Preheat the oven to 375˚. Butter a 9-by-13-inch baking dish. Heat the olive oil and 2 tablespoons butter in a large skillet over medium-low heat. Add the onions, 1 teaspoon salt, a few grinds of pepper and the sugar. Stir, then cover and cook, stirring once, 10 minutes. Uncover, increase the heat to medium and cook, stirring, 10 more minutes. Add the thyme, sherry and broth. Cook, stirring, until the liquid evaporates and the onions are caramelized, about 15 more minutes.
Melt the remaining 2 tablespoons butter in a dutch oven over medium heat. Stir in the flour and cook 1 minute, then whisk in the heavy cream and milk. Add the remaining ½ teaspoon salt and the nutmeg. Bring to a simmer, whisking until smooth. Cook, stirring, until thickened, 2 to 3 minutes. Remove from the heat. Stir in all but ½ cup each of the gruyère and Swiss until melted. Stir in the potatoes.
Layer half of the potatoes in the baking dish, then half of the onions. Repeat with the remaining potatoes and onions. Sprinkle with the reserved gruyère and Swiss and the parmesan. Cover with foil, tenting it so it doesn’t touch the cheese; bake until the potatoes are tender, 45 to 55 minutes. Uncover and bake until golden brown, 20 to 25 minutes. Let sit 20 minutes before serving. Top with chives.