Melt the butter with the oil in a medium size skillet over medium heat. Add onions and stir to coat. Saute for about 3 minutes. Sprinkle with salt, sugar, and thyme. Saute another 10 minutes, until the onions begin to turn golden. Transfer contents of skillet to a mixing bowl and allow to cool.
Preheat oven to 350°F.
In the bowl of an electric mixer, beat the cream cheese and mayonnaise together until smooth. Begin at slow speed and increase to medium. Fold in the onions and Gruyere cheese and stir until blended.
Bake at 350 F for 20 minutes.
Dip may be spooned into a bread bowl or 1 quart casserole dish and refrigerated for 3 days or frozen for up to 2 months. Defrost dip in fridge and bring to room temperature for 20 minutes before baking.