Preheat the oven to 300°F. Cut the top off each head of garlic, exposing just a tiny bit of each clove, and place the heads in a baking pan. Drizzle with olive oil, sprinkle with salt and pepper, and add the thyme to the pan. Cover with foil and bake, basting with a little oil halfway through, until completely tender, about 1 hour. Let stand until cool enough to handle, then squeeze the garlic from the peels.
Melt the butter in a heavy medium saucepan over low heat. Add the onions and cook until tender and translucent, about 7 minutes. Add the potatoes and enough chicken stock to cover. Heat to boiling, then reduce the heat and simmer until the potatoes are very tender.
Stir the garlic into the soup and puree the soup in a blender. Thin with additional stock if necessary. Season with 1 teaspoon salt and ½ teaspoon pepper. If the soup is too garlicky, stir in the cream. Reheat and garnish. (This soup can be made a day ahead of time and reheated.)