Foster kept his nerve to kick Saints to the top of Super League
Jamie Foster's last-minute touchline kick sent St Helens to the top of Super League with victory over Castleford.
Two Tom Armstrong tries, both converted by Foster, gave Saints a narrow half-time advantage over Stuart Jones's try and two Kirk Dixon goals for Cas.
Rangi Chase's converted try put the visitors 14-12 ahead after the break.
Jordan Thompson extended Cas's lead with 15 minutes left before Ade Gardner struck back for Saints and Francis Meli went in with eight seconds remaining.
The Tigers looked to have secured top spot in the Super League for themselves with a-quarter-of-an-hour left.
They had an eight-point lead and the Saints players, after their bruising Good Friday encounter with Wigan, were leaving the field in rapid succession.
The game started in very different fashion with both sides testing each other out and a quarter of the game had gone before Armstrong scored with his first touch of the game when he hit Sia Soliola's pass at pace.
Foster added the extras but was at fault for the Tigers' first try when he spilled Chase's swirling kick and Jones muscled over from close range with Dixon adding the goal.
A penalty put the visitors ahead on the 32nd minute but Armstrong claimed his second just before the break.
The Castleford defence appeared to stop and question whether the ball had been knocked from Soliola's grasp in the build-up.
The officials decided not and the score stood - which Foster kicked from the touchline.
Chase capitalised when Saints stood off him after the break and he glided in from 20 metres out.
Dixon again was on song with his boot and was given the benefit of the doubt when his next goal received a split decision from the judges after Thompson polished off a fine move orchestrated by Chase and Danny Orr.
The Tigers lost Craig Huby, who injured himself in a tackle, and play was stopped while he was carried off on a stretcher.
Saints rallied when Jon Wilkin gathered his own kick and Michael Shenton created the space for Gardner to go in at the corner.
Foster missed with the goal, leaving the visitors holding onto a four-point lead.
But with seconds on the clock Meli went over in the corner and Foster held his nerve to convert from the touchline for victory.
St Helens coach Royce Simmons: "We were very impatient. Five times we got into positions where, if we had taken the tackle, got up and played the ball we would have scored.
"But instead we wanted to throw one-handers and threw bad passes. But that is what happens when you go looking for the soft win and Cas are a very good side.
"In defence we also tended to stand off Rangi Chase and if you do that to a player like him he becomes very dangerous."
Castleford coach Terry Matterson: "We were the best side and have had it taken away from us. We were outstanding, but did not get one call all game. Every week you get refereed a different way, it is very frustrating.
"Nobody expected us to come here and win and we are doing all right after 12 rounds - but we are disappointed with what we have got from the last three games, particularly Easter.
"It makes it tougher for Friday's game particularly as we are going to be without Craig Huby, but there is plenty of grit and determination in the team and we could not have done any more today."
Bookmark with:
What are these?