Birmingham Clayton Donaldson was fouled on the right edge of the box by Anthony Gerrard and Cotterill stepped up for the set-piece. Alex Smithies, the Huddersfield goalkeeper, seemed to have the shot covered, but as he put his hands up to catch the ball, it moved in mid-air and flew into the net.
Town striker Grant Holt had earlier gone closest to scoring in a game short on entertainment. Holt was first to react when Sean Scannell’s scuffed shot from a Lee Peltier cross spun across the six-yard box on 40 minutes.
The on-loan Wigan frontman hit a powerful first-time shot, which Blues keeper Darren Randolph brilliantly parried.
Huddersfield, thrashed 5-0 at Norwich City last week, had not lost at home in seven matches prior to the visit of Birmingham, while the visitors have lost only twice in eight games since manager Gary Rowett took over on October 27.
Birmingham created the best move of the first half on 15 minutes, when Huddersfield’s Jonathan Hogg gave the ball away in midfield. Cotterill, Demarai Gray and Andrew Shinnie were involved, but David Davis drilled a 25-yard drive wide.
Gray, who hit a hat-trick in a 6-1 win over Reading last week, was then at the centre of another breakaway. Birmingham cleared a Jacob Butterfield free-kick on 32 minutes and Shinnie fed Gray, who in turn set up Davis for another blast wide.
Harry Bunn shot wide at the other end on 44 minutes after Holt and Peltier combined down the right.
The visitors started the second half on top and they looked more likely to break the deadlock than an out-of-sorts Huddersfield.
Cotterill shot wide from a Paul Caddis cross on 49 minutes and then the midfielder turned provider on 64 minutes. A short corner routine saw Cotterill cross from the left and Davis out-jumped his marker at the near post but headed wide.
Gerrard did the same at the other end from a Butterfield corner on 79 minutes, while substitute James Vaughan also failed to hit the target late on.
Stoppage-time Town pressure saw substitute Joe Lolley force Randolph into a good save after a jinking solo run into the box.
Conor Coady was also denied by a goal-line clearance at the death. Home fans booed at the end after a result that pushed the team closer to the drop zone.