Preheat oven to 400°F. Coat a 9x13 pan with cooking spray and set aside.
Add the onion, carrot, celery and garlic to a food processor and puree until a paste forms. Heat olive oil in a large skillet over medium-high heat. Add the pureed veggies and cook until the water has evaporated and they have become brown, about 10 minutes.
Add the ground meat, crumbling the meat with a wooden spoon. Cook for about 5-7 minutes or until the meat is cooked through and beginning to brown.
Stir in the oregano, thyme and red pepper flakes and cook for an additional minute. Pour wine in to scrape up any brown bits. Let cook for a minute, before adding the tomato puree, tomato paste, salt, pepper, and basil, stirring to combine. Bring to a boil and then lower the heat, simmering for 10 minutes.
While sauce is simmering bring pot of salted water to boil and cook rigatoni 2 minutes less than al dente. Drain the rigatoni and add to sauce.
Add half of the pasta to the baking dish. Top with half of the mozzarella and Parmesan cheese. Add the remaining pasta and top with the remaining cheeses. Bake for 30-35 minutes or until the top is golden brown and bubbly. Garnish with basil.