It was a tale of two halves, but one that had a happy ending for Wakefield Trinity.
After an impressive first-half display, Wakefield struggled to replicate it in the second period as Huddersfield came from behind twice in a closely-contested derby.
Oliver Russell was almost the hero for the hosts, kicking a drop-goal eight minutes from time.
However, Ryan Hampshire slotted over a penalty goal on 75 minutes to give Trinity the narrowest of victories and send them back into third spot in the table.
It is the second time this season that a meeting between these two sides has been settled by one point.
The away side were finding it easier to make their carries count while the Giants rarely threatened the Trinity line in the first half hour.
Wakefield were 18-6 ahead after 30 minutes and mounted a superb defensive effort in the final 10 minutes of the first half to keep Huddersfield at bay.
A Mason Caton-Brown double and a superb effort from David Fifita had put Trinity well ahead.
The visitors deserved their lead at the break, however their advantage vanished 12 minutes into the second half.
Two tries for Jermaine McGillvary, who has now scored in his last four games against Wakefield, got the home side on terms.
Adam O'Brien put Huddersfield in front before the hour before Bens Jones-Bishop's try levelled proceedings.
And after a frantic back-and-forth in the final 10 minutes, Hampshire's two points proved vital.
Both sides have been plagued by injuries in recent weeks but it was Wakefield who initially coped best without their star men.
The Giants fought back well after the second-half restart, though, giving Trinity little relief in defence.
The visiting pack did a sterling job while Lee Kershaw and Caton-Brown were a constant threat on the left edge in the first 40.
Two early tries from Caton-Brown put Wakefield in control. He got his first as he took a perfectly-timed pass from Ben Reynolds to burst through and score.
The utility back is enjoying life back at Wakefield and put his side further in front when he plucked the ball from dummy half and fought his way past Oliver Russell to plant down.
Huddersfield had struggled to mount pressure in the first quarter but they opened their account just moments after Caton-Brown had put Trinity two tries ahead.
The hosts forced a goal-line dropout and after two hulking charges from Ukuma Ta'ai and Suaia Matagi, the ball came to Matt Frawley and he twisted out of the tackle to dot down by the uprights.
The Giants must be sick of the sight of Fifita as the forward scored Trinity's third try with a great piece of quick thinking.
The 29-year-old scored twice when the sides met last month and was on hand to restore the visitors' two-try advantage.
Caton-Brown palmed a high kick back to Danny Kirmond who moved it to Fifita. The Wakefield prop kicked through the line from 25 metres out and grounded his own kick after Darnell McIntosh had slipped while trying to gather.
Hampshire converted for a third time to maintain his 100 per cent record with the boot.
The Giants had four consecutive sets in the final part of the half, but Chris Chester's men held firm as a knock on from McIntosh eased the pressure a minute before the interval.
However, Trinity's own tormentor, McGillvary, hauled the Giants back into the contest with two tries on 48 and 52 minutes respectively.
Huddersfield moved the ball swiftly along the line to the England winger who slid over in the corner before the Giants talisman was then given space down the right as Kershaw failed to intercept, allowing McGillvary to grab his second.
Roberts landed two impressive conversions from the touchline to level the scores.
Moments later, Wakefield were behind for the first time as O'Brien went from dummy half on the last to plant down by the posts.
A rare second-half error from the home side gave Wakefield a route back into the game on 66 minutes.
Reece Lyne pounced on a dropped ball and found Jones-Bishop on his inside and the winger sped 80 metres to level proceedings.
Things got worse for Huddersfield as they were reduced to 12 men when Ta'ai was sin-binned for a high tackle.
Russell landed his drop-goal but Hampshire's boot had the final say as he converted the winning penalty to send Wakefield back into third.
Huddersfield Giants: McIntosh, McGillvary, Turner, I. Senior, Uate, Russell, Frawley, Ta’ai, Leeming, Matagi, Murphy, Mellor, Lawrence. Substitutes: O’Brien, Roberts, Hewitt, Clough.
Wakefield Trinity: Jowitt, Jones-Bishop, Lyne, Caton-Brown, Kershaw, Hampshire, Reynolds, Fifita, Randell, Arona, Kirmond, Horo, Crowther. Substitutes: Wood, Kopczak, King, Pauli.