Melt 2 tablespoons butter in a saucepan over medium heat, soften the onion for 4 minutes, then stir in the garlic and thyme for 30 seconds.
Stir in the flour for 1 minute, whisk in the milk and cream, season, and simmer gently for 4 minutes until the sauce coats a spoon.
Off the heat, stir in half the Gruyère and half the cheddar, then adjust the salt.
Layer potatoes and sauce in thirds in the buttered 9 by 13-inch dish, press down, and tap out air.
Cover with foil and bake at 400°F for 35 minutes.
Uncover, add the remaining cheese, bake 20 minutes until deep amber, rest 10 minutes, and finish with chives.