Heat olive oil in a large skillet over medium heat. Add diced onion and cook until softened and translucent, about 5 minutes. Stir in minced garlic and cook for another minute until fragrant.
Pour in crushed tomatoes and tomato sauce. Stir in dried basil and oregano. Season with salt and pepper. Let sauce simmer for 10 minutes, stirring occasionally.
Lower heat and carefully stir in heavy cream to create a rich, velvety sauce.
Add gnocchi directly to the sauce and gently stir to coat each piece.
Pour gnocchi and sauce mixture into an oven-safe baking dish. Sprinkle shredded mozzarella and grated Parmesan evenly over the top.
Bake in a preheated oven at 375°F (190°C) for 20-25 minutes, until cheese is melted, golden, and bubbly.
Remove from oven and let rest for a few minutes. Garnish with fresh basil leaves before serving.