The Yorkshire side went in front with a Danny Webber opener, but an own goal from the Blades skipper Chris Morgan gave the visitors a lifeline.
And eight minutes from the end, a hotly disputed penalty gifted Kevin Blackwell's side the spot-kick and Cotterill converted with his first goal for the club.
United's breakthrough came two minutes from the end of a tight first half.
Gary Naysmith swung a super cross from the left and towering striker Darius Henderson - back after a four-match suspension - found space in the area.
Blues were yelling for an offside flag but in the mean time Henderson's strike partner Webber stretched his leg and guided the ball into the net past Maik Taylor.
The protests from the visitors went unheeded and the Yorkshire side were delighted to grab the lead.
Blues had come close themselves to snatching an early advantage after only eight minutes.
Hameur Bouazza curled in a testing free-kick from the right and Marcus Bent was perfectly placed to loop a header goalwards but it dropped onto the bar and out.
On the break, the Blues caught out United again and as keeper Paddy Kenny raced off his line, Scott Sinclair lobbed him but his effort was off target.
United edged into control towards the end of the first half but a glorious chance went begging as Henderson headed straight at Stephen Carr, whose clearing header was nodded straight at the keeper by Webber.
But then two minutes before the break, Webber grabbed his sixth of the season .
Blues' lack of scoring attempts prompted manager Alex McLeish to bring on Cameron Jerome for the second half in place of the ineffective Carlos Costly.
United should have stretched their lead but let the visitors off the hook despite a flying start to the second half.
Among the guilty was Henderson who stabbed an early shot wide and then wasted a glorious headed chance after Cotterill's cross.
And only a super double save from Maik Taylor denied the home side a second after 62 minutes.
A Cotterill free-kick had the Blues defence in trouble but the keeper parried Matt Killgallon's header and somehow forced the ball away as fellow centre-back Morgan looked certain to prod the ball in.
Morgan then gave Blues the equaliser when he stuck out a foot and stabbed the ball into his own net after 75 minutes.
Referee Lee Mason then awarded the penalty after Craig Beattie was pushed by Radhi Jaidi as he went for a header and Cotterill tucked it away.