In a blender, puree the basil leaves, Parmesan cheese, 2 cloves garlic, salt, pepper, pine nuts and olive oil until smooth. Set aside.
Preheat oven to 375 degrees. Heat 2 Tbsp. olive oil in a cast iron or other oven proof skillet. Add 3 cloves garlic and shallot. Sautee until translucent, about 2 minutes. Add the tomatoes, red wine vinegar, sugar and red pepper flakes. Toss to coat the tomatoes. Place skillet into the oven and roast for 20 minutes.
While the tomatoes are in the oven, cook and drain the pasta according to package directions. Add the pesto sauce to the still-warm pasta pot over very low heat. Stir in the ricotta cheese until smooth. Add the cooked pasta back to the pot and toss to coat.
Remove the tomatoes from the oven. Plate the pasta. Spoon the tomatoes over the pasta.