Preheat oven to 350°F
Add the tomatoes, garlic, olive oil, fresh thyme springs, chili pepper flakes, salt, and pepper to a baking dish. Bake for 30 minutes or until the garlic and tomatoes are soft.
Once tomatoes and garlic are soft, take dish out of oven, and mash the garlic and tomatoes with a fork. Stir in the beans and return to oven for an additional 20 minutes.
Remove from oven and add grated Gruyère cheese to lightly cover the top (or stir in 2 tablespoons of crème fraîche). Return to over for a few minutes until cheese is melted.
Remove from oven and let the mixture slightly cool. Serve with a crusty toasted bread, either cut in slices or torn.