Kevin Brown scored a hat-trick of tries as Widnes crossed twice in the final seven minutes to see off Hull KR.
Jack Owens, Dave Allen and Brown all scored tries as the visitors led 18-16, Michael Weyman, Kris Welham and Rhys Lovegrove replying for the home side.
Ben Cockayne and Brown swapped tries before Ade Gardner put the hosts in front and a Travis Burns drop-goal looked to have sealed victory.
But Jon Clarke and Brown went over to complete a dramatic win for Widnes.
Denis Betts' side are fifth in the table, just five points behind leaders Leeds with a game in hand on the Rhinos, while the Robins lie 10th, a point outside the top eight.
Widnes, who confirmed before the game that Australian second-row forward Danny Galea had signed a new two-year deal with the club, made the better start and were quickly in front when half-back Brown fed young winger Owens for the first try of the game.
Weyman levelled before Allen and Brown's first gave the Vikings a 12-point advantage.
But Hull KR crossed twice in the final four minutes of the first half, firstly Welham combining with Craig Hall and then Lovegrove touching down from Kris Keating's pass, to reduce the deficit to two points.
Craig Sandercock's men led for the first time in the match shortly after the interval as Cockayne intercepted Brown's offload and ran the length of the field to score, but Brown quickly restored parity with his second.
Hull KR winger Gardner added his side's fifth try, and when Burns landed a one-pointer to make it 29-22, the hosts looked set for a fifth win in six Super League matches.
But Widnes fought back to claim victory late on, with skipper Clarke taking a pass from Cameron Phelps to go over from 30 metres and then Brown completing his treble.
Hull KR coach Craig Sandercock:
"We should have won that with a seven-point lead and seven minutes remaining.
"There were some really poor individual errors that let the team down. They weren't just in the final stages of the game, but throughout the game.
"Widnes are a dangerous side and that's why they are winning. Kevin Brown is a world-class player and he made us pay in the end."
Widnes Vikings coach Denis Betts:
"To show the character was pleasing against the quality of Hull KR and the crowd that got behind them.
"They put us under the pump but everyone wants to work hard and fight hard for each other in this team.
"When Burns dropped that goal, there was plenty of rugby left to play. We got some opportunities, took them and it's a great win."
Hull KR: Cockayne; Gardner, Ulugia, Welham, Hall; Burns, Keating; Green, J. Hodgson, Weyman, Larroyer, Cox, Costigan.
Replacements: Langley, J. Walker, Horne, Lovegrove.
Widnes Vikings: Hanbury; Owens, Phelps, Dean, Flynn; Brown, Craven; Johnson, Clarke, Gerrard, Allen, Tickle, Leuluai.
Replacements: White, Kavanagh, Isa, Clough.
Referee: Robert Hicks