Melt butter in a large Dutch oven or heavy pot on medium-low heat. Add onions and sprinkle the sugar over it. Stir occasionally and cook until tender and golden and begin to caramelize (takes about 20-25 minutes until golden).
Sprinkle flour over onions, and stir to coat.
Add sherry, stock, Worcestshire sauce, thyme, and bring to a simmer. Cook, partially covered, for about 30 minutes, to allow the flavors to combine. Season with salt and pepper to taste.
Meanwhile, lightly toast bread under a broiler; set aside. Ladle hot soup into six ovenproof bowls. Arrange the bowls on a baking pan.
Place 1 or 2 slices of toasted bread over each bowl of soup.
Sprinkle 1/2 cup grated cheese over bread in each bowl, and place under the broiler until cheese is melted and crusty brown around the edges. Watch carefully that bread doesn't burn. Serve immediately.