I think this is a pretty good question and I've been experimenting myself. I made a small terrarium out of a glass bowl from Walmart. I started it with a layer of gravel, weed cloth to keep the dirt out, activated carbon, potting soil, then the plants. I've since had to take it apart, clean it, replace the dirt, and repot everything. The plants have done fine, but I've wondered if I couldn't take the ecosystem a bit further and add worms.
So as I've planted or dug holes around the yard, if I'd find a random earthworm, I'd drop it in the terrarium. For the most part, I don't think they survived, because I'd never see them. They could have just been in the middle of the dirt, not liking light, but I don't know for sure. I do know that one earthworm I dropped in there was there for months. He didn't seem particularly bright. He made a tunnel around the perimeter of the bowl and would often follow the tract around and around. He would go into the center of the dirt sometimes and I'd occasionally catch him on top, especially after I watered. I was much more careful with my watering as there were no drain holes.
I've since started a vermicomposting bin. I've learned that earthworms are solitary creatures and they don't survive in shallow systems. They aren't any good for this type of thing. However, red wrigglers should be ideal. They like to mass together and only operate in the top 18" of soil. They don't actually eat the food they are provided, but the bacteria that break down that food.
I started reading up on a site called redwormcomposting.com The man there often experiments with his worms. He'll put them in larger and smaller containers, use different bedding, inside and outside bins, alternate air flows, etc... He did an experiment where he put 4 worms in a cool whip container. They did fine an propagated.
So I think your worms could very well survive in the pot and possible thrive. I think they would be able to eat bacteria on dead and dying roots and help improve the plant. I think they'd help clean up and fallen plant matter. I think there waste would provide a small quantity of vital nutrients for the plant.
However, if you'd like to put a little more effort into it, you should look into setting up a small worm bin. The small ones are fairly easy to maintain. Us just use a couple of Rubbermaid containers, one with holes for the worms and one to catch any drainage. Then just feed them your kitchen scraps as they eat them. They'll turn cardboard and potato peels into quality plant food. You'll get a much bigger benefit than just having a few in the pot.
Also, keep in mind that while the worms produce fertilizer, it's really a situation of you get out what you put in. So a couple of worms in a pot are going to eat a little dead plant material and produce a little fertilizer. A vermicomposting bin is going to turn vegetable matter, egg shells, coffee grounds, etc... into a rich fertilizer and do it on a larger scale. You can then empty the bin, put the worms in new bedding with food, and dole out the worm casting (poo) to your pots as needed.
So give it a shot. If you don't feel like making a whole worm bin, then make sure to put bury the occasional scrap of lettuce or potato peel in the pot. It doesn't have to be deep, just covered.