The striker's cool 88th-minute finish completed the turnaround after a calamitous defensive mix-up involving Rovers goalkeeper Carl Ikeme and Herita Ilunga allowed King to draw Blues level just after the hour mark.
Rovers, whose surprise 1-0 win over leaders Southampton last weekend lifted them off the foot of the table, had taken the lead through Marc-Antoine Fortune's first goal since his recent loan move from West Brom shortly after the restart.
It was a fair result on the balance of play from what was an entertaining npower Championship clash, which could easily have contained more goals but for some wayward finishing.
Victory ended a four-match winless sequence for promotion-chasing City in all competitions - all of which have come away from home - and ensured manager Chris Hughton will celebrate his 53rd birthday tomorrow in style.
Blues showed two changes from Wednesday's 2-1 defeat at Hull, Curtis Davies and Guirane N'Daw coming in for Pablo Ibanez and Keith Fahey respectively, while Doncaster named the same XI who saw off Southampton.
It was City who started the brighter of the two sides but the clearest opening of the first quarter went the visitors' way.
James Coppinger first fired straight at Boaz Myhill before a mix-up in City's defence subsequently presented Simon Gillett with a chance from the edge of the area which he could only drag wide.
Veteran right-back Stephen Carr came close to what would have been his first goal for Birmingham since his arrival in February 2009 when his drive was deflected off target by Herold Goulon.
The hosts then saw loud penalty appeals waved away by referee Nigel Miller, claiming David Murphy's right-footed volley struck the hand of Gillett just before the half-hour mark.
Chris Wood and Billy Sharp sent headers wide at either end before Jonathan Spector's last-ditch tackle superbly denied Fortune who appeared clean through.
Wood, who took his goal tally for the season to 11 at the KC Stadium in midweek, failed to do better with a header from Murphy's inch-perfect cross before he was then denied by a super save from Ikeme just before the break.
The second half continued in the same vein, with an early wasted chance at either end as Brian Stock and King both fired off target.
But the deadlock was finally broken in the 50th minute courtesy of a Doncaster counter-attack which was rounded off when Fortune received a pass from Sharp, took a touch and fired low past Myhill.
However, Birmingham were level 12 minutes later as Chris Burke robbed Rovers defender Ilunga of possession after a loose pass from Ikeme and fed King, who levelled matters from 12 yards.
The hosts, spurred on by substitute Nathan Redmond, applied all the pressure in search of victory.
And it came just two minutes from time as Burke again proved provider for King and the striker slotted past Ikeme.
The result extended Birmingham's unbeaten home record this season and was their seventh successive defeat of Doncaster, who have not tasted success in the fixture since 1954.