Gareth O’Brien’s 77th minute drop goal secured a 13-12 win for Salford after Tigers had led 6-0 and 12-4.
The hosts deserved it, but being brought back to earth probably won’t do Cas any long-term harm.
They rarely applied pressure in the hosts’ territory and Salford did a fine job of closing down half-back Luke Gale.
The flashy stuff which Cas have become known for this season did not come off in the first half and was impossible when the rain started after the break.
Cas were also disrupted by injuries in the outside-backs, after going into the game with a huge bench.
They have scored some glorious tries this season, but the opener in this game wasn’t among them.
After five minutes Gale’s kick bounced away from Greg Johnson, there was a scramble - in which Greg Eden seemed to be taken out - and Gale followed-up to touch down.
He also converted, but that completed Cas’ first-half scoring. Tigers’ only real spell of pressure came in the final three minutes, after Salford’s Robert Lui was penalised for moving off the mark.
Gale’s grubber was scooped dead by Johnson to concede a drop out and from that Michael Shenton sent Eden over, but the final pass was ruled forward.
Salford did most of the attacking in the opening period, but managed just one, unconverted, try when Ben Murdoch-Masila - who had been held up over the line earlier on - powered through from Lui’s pass.
That came eight minutes before the interval following a drop-out and successive penalties. The first of those was awarded against Matt Cook for moving off the mark, which seems to be the current fad among referees.
Greg Minikin scored his ninth try of the season just two minutes into the second half. It was a remarkable effort, the winger carrying Justin Carney, Gareth O’Brien and Michael Dobson over with him after Jake Webster had pounced on Junior Sa’u’s error.
Gale converted, but Minikin suffered a shoulder injury in the act of scoring and went off so Webster moved to the right-wing and Mike McMeeken into the centres.
When Webster was concussed soon afterwards, Zak Hardaker went to the wing, with Ben Roberts at full-back, Paul McShane in the halves and Adam Milner at hooker.
Murdoch-Masila showed similar strength to get Salford back in the game on 54 minutes, storming over after Hardaker had failed to cope with Lui’s kick.
O’Brien’s conversion made it a two-point ball game and it was all square with 13 left when McMeeken made a vital stop on Adam Walne, but held on long to and O’Brien took the two.
With three minutes remaining O’Brien’s kick went dead, but Eden knocked on trying to offload from the tap and the full-back landed a well-taken one-pointer to stun Tigers’ 2,000 traveling fans.
Salford Red Devils: O’Brien, Johnson, Welham, Sa’u, J Carney, Lui, Dobson, A Walne, Tomkins, Mossop, Murdoch-Masila, Griffin. Flanagan. Subs: Brining, Krasniqi, Kopczak, T Carney (unused).
Castleford Tigers: Hardaker, Minikin, Webster, Shenton, Eden, Roberts, Gale, Lynch, McShane, Massey, Sene-Lefao, McMeeken, Milner Subs: Millington, Moors, Cook, Springer.
Referee: Phil Bentham (Warrington). Attendance: 5,221