Castleford preserved their proud record of never being outside the top flight for at least another week, but only by the narrowest of margins.
Francis Maloney's drop goal 10 minutes from time gave them the victory they needed to take the relegation battle into the last weekend. Cas, back markers all year, will stay up if they beat Wakefield on Saturday and Widnes, who were on the brink of safety virtually all through this match, lose at Hull.
"We're still the underdogs," Gary Mercer, the Castleford coach, said. "We're still there as a club. We live another day."
It did not look that way midway through the second half when, six points behind, they saw Stephen Myler's drop goal attempt head for the target only to come back off a post. The escape inspired them. After 65 minutes of never really looking like breaking Widnes down, Craig Greenhill's break sent Jonny Hepworth scampering over with Wayne Godwin kicking the equalising goal.
Then it was down to Maloney's cool head and marksmanship although there was a heart stopping moment for Castleford's fans in the last minute when Adam Hughes came so close to touching down in the corner from Jules O'Neill's kick and snatching victory back for Widnes.
"I thought we were the better side for 95 per cent of the game," Frank Endacott, Widnes' coaching advisor, said. "It was that last five per cent that got away from us."
This was a tension-packed affair in which both sides tackled as though their livelihoods depended on it, as indeed they did. Castleford, with Waine Pryce heroic under a peppering of kicks, did outstandingly well to limit Widnes to a six-point lead in the first half.
Those points came when the impressive Myler kicked through, Brad Davis fumbled at the post, and Myler followed up to touch down with O'Neill landing the goal.
Castleford's desperate attempts to get back into the game were hampered by handling mistakes in the rain until Hepworth's vital score, perhaps the most important in the club's history.
Now they and Widnes face an even more tense evening on Saturday and Mercer does not expect any favours from Castleford's neighbours. "We've got to calm down," he said. "We've just got to win."
Widnes: Holmes; Devlin, Bird, Hughes, Murphy; Jules O'Neill, Myler; Julian O'Neill, Millard, McCurrie, Frame, Hay, Finnigan. Substitutes used: Whitaker, Mills, Gallagher, Fa'alogo.
Castelford: Gibson; Pryce, Rogers, Saxton, Mellor; Davis, Maloney; Greenhill, Godwin, Lynch, Harland, Smith, Hudson. Substitutes used: Sykes, Tookey, Hepworth, Jackson.
Referee: K Kirkpatrick (Warrington).