Cut large onions in half lengthwise and slice 1/4 in thick. Cut shallot in half and slice medium thin, cut cipollini or pearl onions in half or quarter depending on the size
Melt butter and olive oil in a large Dutch oven or heavy pot over medium heat. Add onions. Spread them out in as thin a layer as possible. Cook, stirring as needed to keep onions from sticking, until they are melting and soft, golden brown, and beginning to caramelize, about 1 hour. If you are having trouble with sticking, add a bit of water as needed.
Sprinkle flour or corn starch over onions if using, and stir. Add sherry, stock, and 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.
Toast bread slices.
Preheat broiler. Place 1 cup hot soup into four 13-ounce ramekins or ovenproof bowls. Arrange the bowls on a rimmed baked sheet. Place 2 slices of toasted bread over each bowl of soup to cover the surface of the soup completely. Sprinkle 3 ounces grated cheese over bread in each bowl, and place under broiler until cheese is melted and crusty brown around the edges. Watch carefully that bread doesn't burn. Serve immediately.