Set a large soup pot over medium-high heat. Add the chicken thighs, skin side down, and season with salt. Cook for 3 to 4 minutes on each side, until golden, stirring them around a little so the meat won't stick to the bottom. (Be careful not to burn yourself with the sizzling chicken fat.).
Remove the chicken from the pot and set aside on a plate. Pour out and discard the excess fat from the pot. Lower the heat to medium-low. Melt the butter in the pot, add the garlic and onions, season with salt, and stir. Cover and cook for 25 minutes, stirring from time to time to avoid colouring, until the onions are very soft.
While the onions are cooking, remove the skin from the chicken thighs- don't worry if you can't remove all of it. When the onions are soft, add the flour, if using, and stir to blend. Add the chicken, bay leaves, wine, and stock. Grind the peppercorns with a mortar and pestle or spice grinder, or by crushing them on a cutting board with a rolling pin. Reserve 1 teaspoon for garnish, and add the rest to the pot. Bring the soup to a simmer, cover, and cook for 30 to 35 minutes, until the chicken is cooked through. Let it simmer for 20 more minutes, uncovered. (The recipe can be made a day ahead up to this point. Let cool, cover, and refrigerate. The next day, skim the chicken fat from the surface.).
Preheat the oven on the broiler setting. Remove the chicken thighs from the pot and bone them with a fork and knife. Discard the bones and any remaining strips of skin, and cut the meat into bite-size chunks. Return the meat to the pot, stir, taste the broth, and adjust the seasoning. Ladle the soup into ovenproof bowls or soup plates, top each with a slice of bread, and sprinkle with grated cheese.
Put the bowls under the broiler for a few minutes, watching them closely, until the cheese is melted, bubbly in places, and lightly golden. (If your oven isn't large enough to accommodate all the bowls, work in batches: the first bowls will be a bit less hot than the last, but still hot enough.) Sprinkle with the reserved peppercorns and serve: set each bowl on a folded napkin if your table needs to be protected from heat, and warn your guests that the bowls and soup will be very hot.