The Titfield Thunerbolt - A classic comedy about a group of locals who, upset at the closure of their branch line, set out to reopen it themselves. Very much inspired by early days of the preserved Talyllyn Railway The Ladykillers (The original 50s one) - Another classic comedy, the railway is less central to the plot of this one, but it includes very atmospheric shots of the railway around London Kings Cross.
The End of the Line with Wilford Brimley and Kevin Bacon. Two railway employees steal a locomotive and take it to the company headquarters to confront the owners, who are planning to close the railroad.
Silver Streak (1974) is a comedy with Gene Wilder and Richard Pryor, set primarily aboard the fictional "Silver Streak".
It's got a big cast, it's funny and there's some nice older Canadian Pacific footage.
I should warn that there are some racial jokes in there that are a bit... "old fashioned" but it's not particularly mean-spirited.
1) "The General" with Buster Keaton. A silent movie about the civil war. Steam engine chases!
2) "The Cassandra Crossing" with Richard Harris, Sophia Loren. The plague gets aboard a train in Europe.
3) "Emperor of the North" with Ernest Borgnine. Life as a hobo and hopping trains.
I never really saw this one but rails and ties but this one was great: the station agent
wiki the station agent its not letting me paste the link sorry the trainz forms has been having this problem where when I reply to a comment or thread it continually loads and sometimes my keyboard decides to respond because its loading