A rail worker and a passer-by attracted the attention of driver of a train as it approached a jack-knifed lorry on the line in Co Longford, averting a potentially serious collision.
The incident happened last night soon after the crowded Dublin-Sligo train left Edgesworthtown station less than a mile from the crossing.
Rail linesman Mr Mark Cassidy spotted the crashed lorry and ran up the track waving a red flag after setting warning detonators on the track with local man Mr Liam Kerrigan.
"It was imperative that we stopped the train before it collided with the lorry. I was only acting within the scope of my duties. The driver of the train was very vigilant and brought it to a halt as soon as he saw us," Mr Cassidy said today.
The train's 250 passengers completed their journey by bus. Gardaí and Irish Rail officials are investigating the accident today.
A rail company spokesman said: "A potentially horrific accident was averted by the actions of these men."
PA