Prepare the Garlic: Peel the garlic cloves and set them aside. For a sweeter, less pungent flavor, blanch the garlic cloves in boiling water for 1 minute, then drain.
Cook the Onion and Garlic: In a large pot, heat olive oil over medium heat. Add the onion and sauté until translucent, about 5 minutes. Add the garlic cloves and cook for an additional 5-7 minutes, stirring occasionally, until they are softened and lightly golden.
Simmer the Soup: Add the chicken or vegetable stock, thyme, and bay leaf to the pot. Bring to a boil, then reduce heat to low and let it simmer for 25 minutes. Remove the thyme sprigs and bay leaf.
Blend and Season: Use an immersion blender to puree the soup until smooth, or transfer it to a blender in batches. Stir in the heavy cream (if using) and season with salt and pepper to taste.
Serve: Ladle the soup into bowls, top each with a slice of toasted bread, and sprinkle with grated cheese. Broil for 1-2 minutes until the cheese is melted and bubbly. Serve immediately.