In a small saucepan, melt the butter. Add the onions, and thyme, then whisk in the flour. Cook the flour for 1 minute. Add heavy cream and sherry, and continue to whisk. Bring the mixture to a simmer to allow flour to cook out. After cream simmers for about 2 minutes, add the cheese to melt. Season with salt and pepper.