Megapixels is the first thing non-digital photographers learn about digital photography. The concept of megapixels is highly overrated, if you ask me. More megapixels means you get sharp prints at bigger sizes, but for 4X6 prints, or viewing on a computer, 5 megapixels doesn't help. There are more important features of a camera to consider.
For me, the most important feature has been the zoom capabilities of the camera. Ignore "digital zoom", look for optical zoom, the larger the better. I have a 10X optical zoom camera (Kodak DX6490) and I have found that feature to be extremely helpful in getting good railroad pictures at times (and it has been very helpful in getting good pictures in every other situation as well). Do I really need 10X? Well, if you can't get as close to the tracks as you would like, 10X really does help.
Another feature I like a lot is the burst mode on the camera -- the ability to take six pictures in two seconds. As that train speeds towards your location, put the camera in burst mode and you get pics of the locomotive down the tracks, a little closer, and right on top of you.
So I would definitely recommend
my Kodak DX6490 if you can afford it. Others recommend it highly
"If you get the chance to sit it out or dance, I hope you dance" -- Lee Ann Womack
My Flickr Photos