Centre-back Lynch stabbed home his second goal of the season just when it seemed City had snatched an unlikely victory.
The home side dominated the game but could not find the back of the net and looked to have paid the penalty when winger Cotterill curled home a superb free-kick in the 73rd minute.
The Welsh international scored the only goal in this fixture last season - another superbly-struck free-kick - and also scored against Town at St Andrew’s last term.
Blues boss Gary Rowett had criticised his players for throwing away a two-goal lead against Preston on Tuesday.
And just when Birmingham had survived Huddersfield’s pressure to grab the lead, Lynch was allowed to snatch back the initiative.
Joe Lolley, against his boyhood club, made a strong start to the game with a surging run at the Birmingham defence but he put his finish wide.
Town went close again shortly afterwards when Kyle Dempsey’s curling cross evaded Nahki Wells only for the ball to strike Paul Caddis and go out for a corner.
Dean Whitehead sent Jamie Paterson away and kept running for the return ball but his forward pass into the box caught Wells just off-side.
City had their best chance when David Davis unleashed a powerful 25-yard drive through a packed penalty area only for the unsighted Jed Steer to get down late to turn it away.
Wells dragged a shot wide before Rajiv van La Parra, also a lively presence, crossed for Lolley on the edge of the box.
Lolley struck it sweetly but the ball smashed into the midriff of Wells.
Ten minutes from half-time Tomas Kuszczak pulled off a superb save to keep Huddersfield out.
Wells’ cross was deflected over the bar for a corner. Lolley’s flag kick was flicked on by Lynch for Emyr Huws to head goalwards only for Kuszcak to claw it away.
Huddersfield remained on top in the second half and Davis was booked for a foul in the build-up as Wells was waved through only to be pushed too wide to threaten the goal.
City skipper Michael Morrison almost deflected into his own net from Wells’ cross and Lolley again had an effort deflected wide.
Lolley then fired a free-kick over the bar before City scored through Cotterill.
Whitehead tripped sub Will Buckley on the edge of the box and Cotterill stepped up to curl the free-kick over the wall and into the bottom corner.
The lead only lasted until the 82nd minute when Lynch, up for a dead ball, connected with Sean Scannell’s drive, trapping it and then prodding beyond Kuszczak.
Town almost grabbed the win but Wells was inches away from touching home and Kuszczak brilliantly tipped away Karim Matmour’s shot with the last action of the game.
For all the latest from today’s games, check out The Yorkshire Post’s live feed by clicking the link below....