Bristol City ended the worst run in their history as nine successive defeats were halted by a long overdue win.
They dug deep to cling on to Scot Murray's fifth minute lead and finally sent high-flying Huddersfield to their fourth defeat of the season.
The breakthrough for the early goal came from Bradley Orr's surge down the right and a cross which saw the hard-working Steve Brooker jump above his marker.
The ball skimmed out to Murray to the left of goal and he quickly switched the chance to his right foot before striking his fifth goal of the season.
Until then Huddersfield, second in the table, had been shaping up with some attacking football but City found extra confidence and could have scored twice in the next few minutes.
First David Noble, on loan from Boston before his transfer can be made permanent next month, drove a free-kick inches wide and then crashed another shot just outside the other post.
Gradually though the balance began to swing back Huddersfield's way and they got on top after Marcus Stewart upended Tom Clarke to earn his fifth yellow card and a one-match suspension.
Huddersfield had gone into the game with David Mirfin and Chris Brandon suspended after their fiery midweek draw at MK Dons which brought them six bookings.
They added just one to that tally in this game, midfielder Gary Taylor-Fletcher being booked just before half-time.
Their attitude though stayed cool as they set out to wear City down.
Twice goalkeeper Adriano Basso kept Bristol in front, reaching a fierce 10-yard header from Andy Booth to turn it out for a corner and then saving a 25-yard rifled shot from Pawel Abbott who struggled to impress himself on the game.
There was a long spell of scrappy play as both sides battled for the goal which could decide or open up the match.
It went Bristol's way with a spectacular goal from 18-year old Welsh cap David Cotterill.
He made a long looping run from the left which carried him around three defenders before placing a right-foot shot out of the keeper's reach.