Heat the butter in a large skillet over medium-high heat. Add the onions, garlic, bay leaf, peppercorns, and cloves and reduce the heat to medium-low. Cook for about 20 minutes, or until the onions are soft but not brown. Season with salt to taste.
Line a medium-size ovenproof dish with puff pastry. Remove the cloves, peppercorns, and bay leaf from the onions and discard. Place the onions in the dish and add the grated cheese and 1 teaspoon thyme.