Preheat the oven to 375°F (190°C). Lightly grease a 9x13 inch baking dish and set aside while you prepare the filling.
Heat the olive oil in a large skillet over medium heat. Add the onion and cook, stirring occasionally, until softened and translucent, about 5 minutes.
Stir in the garlic, chili powder, cumin, oregano, and cayenne if using. Cook for about 1 minute, stirring, until the spices are fragrant.
Add the black beans and corn to the skillet. Season with salt and pepper, and cook for 2 to 3 minutes, stirring, until everything is heated through.
Remove the skillet from the heat and stir in the cilantro. Taste and adjust seasoning with more salt, pepper, or a squeeze of lime if desired.
Warm the corn tortillas in a dry skillet, microwave, or low oven until pliable. Place a spoonful of the bean mixture down the center of each tortilla and roll it up snugly.
Arrange the filled tortillas seam-side down in the prepared baking dish, fitting them closely together so they hold their shape.
Pour the enchilada sauce evenly over the rolled tortillas, making sure each one is well coated. Sprinkle the shredded cheese evenly over the top.
Bake the enchiladas for 20 to 25 minutes, or until the sauce is bubbling and the cheese is melted and lightly golden around the edges.
Let the pan rest for 5 to 10 minutes. Serve the Vegetarian Black Bean Enchiladas with sour cream, avocado, salsa, and lime wedges, garnishing with extra cilantro if you like.