St Helens earned a home Coral Challenge Cup quarter-final against Wakefield after beating Huddersfield 22-16 in the final sixth-round tie at the John Smith's Stadium.
The game was nip and tuck as the lead changed hands throughout a tight first half and the Giants, who lost to the Betfred Super League leaders by 28 points in March, pushed Saints harder than many expected.
The sides equally shared four first-half tries as the visitors went in two points ahead.
Yet although Saints, who trailed 10-6 after half an hour, were not behind again, the lead was never more than a converted try and the game not out of reach of the hosts until the final hooter.
St Helens, beaten just once all season, began in the free-flowing vein which had yielded 154 points in their previous three games but Huddersfield's defence held firm until the 12th minute when Lachlan Coote's long pass put Regan Grace in at the corner.
Australian full-back Coote was narrowly wide with the touchline conversion but went on to land three goals from six attempts.
The Giants wasted no time in responding as Adam O'Brien and Matt Frawley combined to send Joe Wardle racing through to score on his 200th career appearance.
Fit-again Lee Gaskell, who began his career at St Helens, had no trouble with the conversion to edge the home side in front.
Coote landed a penalty to square matters after the home side were caught laying on at the ruck.
But the Giants came again and Aaron Murphy needed video replay confirmation to put his side ahead once more after Innes Senior made a miraculous offload just before being hauled into touch.
Gaskell was unsuccessful with the conversion and, five minutes before half-time, Grace found space on the wing and kicked perfectly ahead for Theo Fages to chase and ground.
Coote's subsequent kick swung the pendulum in favour of the visitors with the score 12-10 at the break.
Saints again bossed possession and territory after the restart and Kevin Naiqama almost put Tommy Makinson over with a wonderfully athletic finish in the corner but the pass was adjudged forward.
It was not long though before the thousand or so travelling fans in the stand their side were now attacking could cheer, as Makinson rose to pat back a Fages cross-field kick and Coote was on hand to dive over by the flag.
But back-to-back penalties pushed the Giants forward and Wardle's second try - a fine solo effort under the posts - helped haul Huddersfield level once more.
Saints went ahead for the third time just after the hour when another high Fages kick ricocheted around like a pin-ball before Naiqama pounced to score.
Coote converted but then missed a penalty which would have created a two-score gap for the first time, as Saints clung on to progress to the last eight.