Huddersfield held their nerve in a tense Super League relegation battle at KCOM Craven Park to claim the crucial points with a third win of the season over Hull KR.
The Giants came from 6-0 down to lead 14-6 with seven minutes left but a converted try from Craig Hall set up a dramatic finish and the visitors needed a last-gasp try from England winger Jermaine McGillvary to seal an 18-14 triumph.
The win lifts Huddersfield four points above bottom club London Broncos and two clear of their hosts in a congested danger zone with six rounds left of the season.
After claiming wins over Warrington and Leeds, Hull KR coach Tony Smith was hoping to complete a hat-trick of wins over his former employers but he was dealt a double blow on the eve of the match with the loss of two loan players.
Warrington's decision to recall forwards Luis Johnson and Harvey Livett meant enforced changes to the team that won at Headingley.
Robbie Mulhern replaced Johnson in the front row and Owen Harrison took over Livett's place on the bench while utility forward Danny Addy was a replacement for injured hooker Matt Parcell.
Rovers made use of a couple of back-to-back penalties in the opening stages to set up the position for half-back Josh Drinkwater to slide a grubber kick through the visitors' defence for centre Kane Linnett to score the first try.
Hall added the conversion to make it 6-0 but Smith was forced to reshuffle his side when Linnett went off injured shortly afterwards, with skipper Joel Tomkins moving from the pack to the threequarter line.
Huddersfield were slow starting but they drew level in similar fashion on 11 minutes, prop Matty English touching down Adam O'Brien's kick to the line, and Darnell McIntosh's goal levelled the scores.
From that point on, the Giants dominated the rest of the first half, half-backs Tom Holmes and Lee Gaskell causing all sorts of problems for the Robins defence, but without managing to turn the pressure into points.
The best chance fell to full-back McIntosh after Holmes put second rower Ukuma Ta'a through into a gap but he dropped the final pass and Huddersfield had to settle for 6-6 at the break.
Hull KR thought they had regained the lead four minutes into the second half when full-back Adam Quinlan put in an attacking kick and stole the ball from McIntosh but referee Ben Thaler ruled a knock-on before Hall touched down.
Just two minutes later Huddersfield hit the front for the first time when second rower Alex Mellor took Gaskell's pass to force his way over for their second try.
McIntosh was wide with the conversion attempt but kicked a penalty on 50 minutes to make it 12-6 after substitute Owen Harrison was punished for punching.
When Harrison was penalised again on the hour, this time for a high tackle on Kruise Leeming, McIntosh was on target once more to put his team two scores in front which proved crucial in the end.
Hall went over for Hull KR's second try after accepting Danny McGuire's cut-put pass but McGillvary had the final say when he won the race to Gaskell's precision kick to the corner.