Pawel Abbott grabbed a late winner for Huddersfield in a match marred by an ugly incident which saw Town boss Peter Jackson sent to the stands.
Jackson was banished from the touchline after grabbing Robins substitute Lee Johnson's throat, sparking a mass brawl involving both sets of players.
Bristol City had taken the lead when Phil Jevons pounced on a rebound.
Luke Beckett levelled after a flowing move and Abbott won it in stoppage time by forcing home a corner.
Huddersfield: Glennon, Holdsworth, Mirfin, Nathan Clarke, Adams, Brandon (Schofield 87), Hudson, Worthington, Taylor-Fletcher (Collins 90), Abbott, Beckett (McAliskey 90).
Subs Not Used: Rachubka, Tom Clarke.
Goals: Beckett 64, Abbott 90.
Bristol City: Basso, Orr, Carey, Fontaine, Woodman, Murray (Cotterill 85), Noble, Skuse, McAllister (Showunmi 73), Jevons (Johnson 73), Brooker.
Subs Not Used: McCombe, Hennessey.
Booked: Carey, Woodman, Noble.
Goals: Jevons 49.
Ref: P Taylor (Hertfordshire).