This article is from the Final-Fantasy and other Square Soft Games FAQ, by firstname.lastname@example.org (Nick Zitzmann) with numerous contributions by others.
What you have to do is have your train catch up to the Shinra train,
then get on it and stop it before it crashes into North Corel. To speed
up your train, press Up and the Triangle button in a steady, yet fast
motion (Up, T, Up, T...) Once aboard the Shinra train, fight your way to
the front. Then, make sure there are no messages on the screen. With
Cid grabbing the controls, press:
* Up + T, Down + X, Down + X (or) Down + X, Down + X, Down + X
Don't forget to clear any message boxes between presses. If you entered
either command successfully, the train will stop.