Teenager Kallum Watkins scored a sensational last-minute, 90-metre try for Super League champions Leeds, who came from 12-0 down to secure a crucial win which keeps them in touch with leaders St Helens.
Tough-tackling Huddersfield had threatened to pull off their first win at Headingley for 49 years and leapfrog the Rhinos into second place in the table after harrying the home side into a host of uncharacteristic errors.
The Giants, who earlier this year gained their first win at Bradford for 40 years, led 6-0 at half-time but were forced to defend for most of the second half and the pressure eventually told, with Leeds scoring two tries in the last 11 minutes to secure a particularly hard-fought victory.
Without England trio Jamie Peacock, Danny McGuire and Ryan Hall, the Rhinos will be relieved to get back to winning ways, despite playing well below their best.
Huddersfield, who gave a debut to Danny Sculthorpe in place of England prop Eorl Crabtree, enjoyed the better start, with Martin Aspinwall failing to punish Watkins' early handling error and Shaun Lunt failing to finish off a break from Brett Hodgson.
The misses began to look costly as Leeds built up a head of steam and went on to dominate the rest of the first half, only to come up with a series of near-misses themselves.
The normally clinical Scott Donald fumbled Lee Smith's pass with the line beckoning and comfortably won the chase to his centre partner's kick to the line only to fail to ground the ball.
Substitute Luke Burgess also missed a sitter, dropping Robert Burrow's pass with the Huddersfield defence breached to further suggest it was not going to be Leeds' day.
Giants winger David Hodgson produced a couple of howling errors but finished decisively for the only try of the first half, taking Kevin Brown's final pass to claim his 12th try of the season. Brett Hodgson added the conversion.
It got even better for the visitors when stand-off Kevin Brown dummied his way over for a second try just two minutes into the second half following another handling error from Donald.
Hodgson's second goal made it 12-0 but the Rhinos began the fightback on 46 minutes when centre Keith Senior offloaded from a two-man tackle to get the 17-year-old Watkins over in the corner for his first try.
Sinfield tagged on the goal and the champions suddenly began to look more like their old selves.
Full-back Hodgson somehow managed to get a hand to Burrow's pass to ruin a two-man overlap and winger Hodgson intercepted 20 metres from his own line to diffuse another lively attack.
The Huddersfield line was under almost constant siege but Leeds continued to fritter away chances.
Senior's pass to an unmarked Watkins went into touch, only the post denied Jamie Jones-Buchanan and Giants centre Jamahl Lolesi pulled off a last-ditch tackle to halt Burrow in sight of the line.
The pressure eventually told, however, when prop Kylie Leuluai took Sinfield's short pass to crash over on 69 minutes.
Sinfield's conversion tied the scores and he put his side in front for the first time four minutes later with a 40-metre penalty after on-loan loose forward Lee Mossop was punished for holding down in the tackle.
As Huddersfield went all out for the match-winning try, Watkins intercepted Brett Hodgson's pass and showed a clean pair of heels in a sprint for the line to clinch the victory.