Match ends, Huddersfield Town 3, Preston North End 2.
Huddersfield's faint hopes of automatic promotion were boosted as Collin Quaner's stoppage-time winner surely ended Preston's bid for a top-six spot.
Quaner slotted in on the rebound on 96 minutes after Aaron Mooy's penalty was saved by Preston keeper Chris Maxwell.
North End led through Aiden McGeady's swerving shot but Elias Kachunga headed level for the hosts from a corner.
Jack Payne nodded Huddersfield into a second-half lead before Jordan Hugill's header got the visitors back on terms.
Defeat left the visitors 11 points below the top six with just four matches remaining, after wins for Sheffield Wednesday and Fulham.
Huddersfield controlled the early stages but fell behind to Preston's only shot of the first half, as McGeady's sweet, swerving strike found the top corner.
The hosts were deservedly back on terms when Kachunga headed in at the far post after Maxwell failed to claim a left-wing corner.
A draw seemed likely after Payne and Hugill's headers, but Huddersfield - who had controlled possession - grabbed victory in dramatic circumstances late on.
The penalty was awarded for an off-the-ball incident that saw Hugill booked for a clash with Kachunga, and Quaner was quickest to react to the rebound to net his first league goal for Huddersfield.
Huddersfield head coach David Wagner:
"That sums up what we have seen from the team this season.
"When one player makes a mistake another one steps forward. That's what we are all about.
"It was one heck of a win. It was pure entertainment with a happy end for us. It was a fantastic performance."
Preston manager Simon Grayson:
"I have spoken to the players and the referee [about the penalty decision] and seen it on DVD and it's clear that Jordan didn't push him. It was a very poor refereeing decision.
"I don't go to see a referee very often but I do when I feel I have a genuine complaint. It's a more than disappointing decision.
"The referee says he has pushed him and stamped on him but he must have decent vision to see that."
- 15LöweBooked at 58mins
- 8BillingSubstituted forPayneat 36'minutesSubstituted forHudsonat 90+8'minutes
- 17van La Parra
- 21WellsSubstituted forQuanerat 86'minutes
- 22MaxwellBooked at 90mins
- 2VermijlBooked at 61minsSubstituted forBrowneat 89'minutes
- 5ClarkeSubstituted forSpurrat 17'minutes
- 23HuntingtonBooked at 61mins
- 4PearsonBooked at 58mins
- 12GallagherSubstituted forHorganat 74'minutes
- 25HugillBooked at 90mins
- Lee Probert
- Shots on Target
Second Half ends, Huddersfield Town 3, Preston North End 2.
Substitution, Huddersfield Town. Mark Hudson replaces Jack Payne.
Goal! Huddersfield Town 3, Preston North End 2. Collin Quaner (Huddersfield Town) right footed shot from the centre of the box to the centre of the goal following a set piece situation.
Penalty saved! Aaron Mooy (Huddersfield Town) fails to capitalise on this great opportunity, right footed shot saved in the bottom right corner.
Chris Maxwell (Preston North End) is shown the yellow card.
Jordan Hugill (Preston North End) is shown the yellow card.
Penalty Huddersfield Town. Elias Kachunga draws a foul in the penalty area.
Penalty conceded by Jordan Hugill (Preston North End) after a foul in the penalty area.
Jack Payne (Huddersfield Town) wins a free kick on the right wing.
Foul by Jordan Hugill (Preston North End).
Aaron Mooy (Huddersfield Town) wins a free kick in the defensive half.
Foul by Daniel Johnson (Preston North End).
Foul by Collin Quaner (Huddersfield Town).
Paul Huntington (Preston North End) wins a free kick in the defensive half.
Foul by Rajiv van La Parra (Huddersfield Town).
Ben Pearson (Preston North End) wins a free kick in the defensive half.
Substitution, Preston North End. Alan Browne replaces Marnick Vermijl.
Attempt missed. Rajiv van La Parra (Huddersfield Town) header from the centre of the box misses to the left. Assisted by Tommy Smith with a cross.
Substitution, Huddersfield Town. Collin Quaner replaces Nahki Wells.