St Helens gave Knowsley Road a great send-off as they booked a place in next Saturday's Grand Final at Old Trafford.
Saints were in danger of an upset when tries from Michael Lawrence (2), Shaun Lunt and Saints old boy Lee Gilmour earned Huddersfield a 22-18 lead.
But Paul Wellens' second try, added to second-half efforts from Tony Puletua and Francis Meli, turned it around.
And captain Keiron Cunningham brought the house down with the clinching try on his farewell home appearance.
Saints had made a great start with two tries in the first 13 minutes from Bradford-bound prop Bryn Hargreaves - his first in 17 months.
But they were only 18-16 up at the break after the Giants, once the talismanic Cunningham had gone off for a half-hour breather, fought back to make a contest of it.
Huddersfield, inspired by captain Brett Hodgson on his farewell appearance, then led for the first time seven minutes into the second half.
Shortly after Kyle Eastmond limped off, Knowsley Road was truly silenced when returning centre Gilmour crashed over for the Giants' fourth try.
But, on a night when kick-off had to be delayed by 10 minutes to allow the crowd to pack in, Saints roared back to send the place into raptures with four tries in 19 minutes, capped by captain Cunningham.
Young winger Jamie Foster kicked seven goals from as many attempts and long-serving full-back Wellens would have stolen the show on any other night with two superb touchdowns.
Saints fans were out in force for the game
But, inevitably, it was 33-year-old hooker Cunningham who had the final say with his 175th try on his 495th appearance to ensure that his final appearance before he hangs up his boots will be at Old Trafford.
And, in the last competitive match to be played at Saints' 120-year-old home, that was enough to book Cunningham and his men a fifth successive Grand Final appearance.
The one big blot on an otherwise memorable evening was Eastmond, a big doubt after aggravating his hip injury, lasting until just five minutes into the second half when he gave both club and country another scare as he limped off down the tunnel after damaging his ankle.
But, while he must now be considered a doubt for next weekend, departing coach Mick Potter still has a ready-made replacement in Matty Smith, who played at stand-off after keeping his place following his fairytale return in Saints' 28-12 win over Warrington.
Stunned by two Matt King tries inside the first six minutes in that last outing here a fortnight before, this time it was Saints who got off to a flier when Hargreaves, one of five players making their final home appearances for the club, was first to reach Cunningham's delicate grubber kick.
Saints maintained their early momentum when Giants centre Leroy Cudjoe, who ended the match on crutches after damaging his knee, fumbled Smith's high kick. That gave Hargreaves the chance to strike again, taking Cunningham's pass to spin out of Lunt's attempted tackle.
But the visitors gradually weathered the storm and Lunt made amends for his blunder when he took skipper Hodgson's pass to go through a gap on 21 minutes.
Hodgson's cut-out pass then created the space for winger Lawrence to cross, the Aussie's second touchline conversion levelling the scores.
Saints are into their fifth successive Grand Final
Saints edged back in front when Wellens scored thanks to an inside pass from substitute Paul Clough, but the Giants struck again on the stroke of half-time when Lawrence hacked the ball on from Danny Brough's lofted kick.
Warrington-bound Hodgson was unable to add the goal this time, leaving his side trailing by two points at the break, but they went in front for the first time shortly after the restart when centre Gilmour touched down Hodgson's short stabbed kick on the last tackle.
The Giants captain kicked his third goal to make it 22-18 but it was all square 15 minutes into the second half when Wellens was the first to reach James Roby's grubber kick to the line.
Foster's fourth conversion edged Saints back in front and that was the signal for the home side to press home their advantage as Huddersfield lost their discipline, conceding five consecutive penalties.
Loose forward Puletua proved unstoppable after taking Cunningham's short pass five metres from the line and winger Meli took advantage of an overlap to add another.
Then it was time for captain Cunningham, his place in St Helens sporting immortality already long since assured, to bring down the final curtain in fitting style with the last-ever try at Knowsley Road.
St Helens coach Mick Potter said:
"Keiron Cunningham is phenomenal. To know the finish line is coming up is driving him on. One more good one would be the icing on the cake.
"He turned it for us tonight. He came up with some real aggression in defence and some good advantage line running.
"Kyle Eastmond is having a tough run with injuries. It's his other ankle. His hip is fine and the ankle he initially hurt is fine. He's a bit frustrated at the moment.
"Huddersfield showed tonight how much they've improved over the last two years. They shook us up for a long time and I was very nervous until the last five minutes."
Huddersfield coach Nathan Brown said:
"They say everybody is replaceable but I'm not so sure Keiron Cunningham is replaceable. He's an outstanding player.
"The word great gets thrown about a bit loosely but, if he hadn't played tonight, I dare say the scoreboard would have read a bit more in Huddersfield's favour. The game flowed their way when he was on the field.
"Inside that 10 metres, Saints are probably as good as any side in the world and, through ill-discipline, we invited them in there too much.
"But we are a growing club and I'm really proud of what the boys have achieved this year. We've got to improve a little bit more next year and it might be our turn to go to Old Trafford."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.