Make the sauce: Heat oil in a large sauté pan, set over medium heat. Add the onions and cook for a few minutes, until translucent. Stir in garlic, just until fragrant. Toss in the mushrooms, along with about 1/2 teaspoon salt. Increase heat to medium-high and cook mushrooms, stirring occasionally, for about 10 minutes. Just until they release all of their water and become soft.
Lower heat to medium and add the wine. Cook until most of it evaporates. Pour in 2/3 of vegetable stock and bring to a simmer. Add butter and fresh thyme, stir until completely melted.
Meanwhile, whisk the rest of stock with flour. Add this to mushrooms and cook until the sauce begins to thicken. Remove from heat, taste and add salt and pepper as needed.
Preheat oven to 350°F (175°C). Bring a large pot of water to a boil. Add in the ravioli and cook for 2 minutes, just until it's softened but not fully cooked. Drain ravioli.
Lightly drizzle the bottom of a medium baking dish with olive oil. Add 2/3 of the ravioli, spread out evenly over the dish. Top with 2/3 of the sauce. Add the rest of the ravioli, then the sauce, then mozzarella and lastly parmesan cheese.
Bake until the cheese is bubbly and completely melted, about 20 minutes. Remove from oven and let sit for 10 minutes before serving. (Optional: sprinkle with parsley or thyme before serving.)