Preheat your oven to 400°F (200°C).
Cut the tomatoes in half, lengthwise. Place them on a baking sheet, cut side up.
Drizzle the olive oil over the tomatoes and sprinkle them with salt, pepper, minced garlic, and dried thyme. If you're using fresh thyme, place a few sprigs on top of the tomatoes.
Roast the tomatoes in the preheated oven for about 30-40 minutes or until they're soft and slightly caramelized. While the tomatoes are roasting, heat a large pot over medium heat. Add a little olive oil and sauté the diced onion until it becomes translucent and fragrant.
Once the tomatoes are done roasting, remove them from the oven and let them cool slightly. Then, peel off the tomato skins. Transfer the roasted tomatoes to the pot with the sautéed onions. Remove any thyme sprigs if you used fresh thyme.
Add the red pepper flakes and basil to the pot and stir.
Pour in the vegetable or chicken broth, and bring the mixture to a simmer. Let it cook for about 15-20 minutes to allow the flavors to meld together.
Use an immersion blender or a regular blender to puree the soup until it's smooth. If using a regular blender, be sure to cool the soup a bit first, and blend it in batches.
Return the pureed soup to the pot, and if desired, stir in the heavy cream to make it creamier. Heat the soup over low heat until it's warmed through, but don't boil it.
Taste the soup and adjust the seasoning with salt and pepper if necessary. Serve hot, garnished with additional fresh basil leaves and a drizzle of olive oil, if you like.