Substitute Rhys Healey was the Huddersfield hero as his stoppage-time goal was enough to secure a dramatic and potentially priceless 1-0 win against fellow strugglers Millwall.
Healey pounced to head home from close range after Millwall goalkeeper Matija Sarkic could only parry Matty Pearson’s effort into his path.
The three points lift the Terriers out of the Championship drop zone.
Millwall, meanwhile, are now just two points clear of the relegation places, and will still be looking over their shoulders after a fourth match without a win.
The Terriers almost struck inside two minutes at the John Smith’s Stadium.
Some excellent work from Sorba Thomas paved the way through for Delano Burgzorg, but the Dutchman’s firm strike was excellently saved by Sarkic.
There was a swift response from Millwall, however.
Billy Mitchell pounced on a loose ball before seeing his shot saved confidently by Lee Nicholls.
The Lions threatened again when George Honeyman rose well to meet Ryan Longman’s cross, only to then direct a header off-target.
There was plenty of enterprise and endeavour in what proved to be an entertaining opening spell, and that despite a swirling wind.
Huddersfield were next to go close when Thomas’ delivery was flicked wide at the near post by Bojan Radulovic.
With Millwall now pressing for an opener, Michael Obafemi almost struck when his acrobatic effort was deflected behind for a corner by midfielder Alex Matos.
Jake Cooper then ought to have registered for the visitors, but he planted a golden headed chance over the crossbar from close range.
As half-time approached the pendulum was beginning to swing back Huddersfield’s way.
Thomas’ 25-yard blockbuster was saved by Sarkic, while Josh Koroma also fired inches over the top with his effort from the edge of the box.
There was a frantic start to the second period.
After a Millwall attack at one end, the Terriers broke quickly.
Radulovic found space and pulled the ball back into the path of Koroma, but he could not find the target from a great position.
David Kasumu then missed another decent opportunity as he fired wide following a tidy one-two with the impressive Koroma.
Back came Neil Harris’ Millwall in this end-to-end clash, with Ryan Leonard lashing over the top when he ought to have done better with options around him.
As the 70-minute mark passed, both sides then appeared to run out of steam, with tired bodies and heavy legs clearly evident.
Huddersfield’s Polish defender Michal Helik threw himself at a cross from Brodie Spencer, but he was thwarted by a last-ditch block.
After that, Huddersfield sub Healey went close to notching a winner, before then pouncing to finally do the business in predatory style right at the death.