Match ends, Bolton Wanderers 2, Birmingham City 2.
Paul Caddis's 93rd-minute equaliser saw Birmingham escape relegation to League One in dramatic style.
The Blues needed a draw at Bolton to stay up but looked doomed when they trailed 2-0 to goals by Lee Chung-yong and Lukas Jutkiewicz.
But Nikola Zigic gave Lee Clark's side hope when he pulled a goal back with a header with 12 minutes to go.
And a desperate finish saw Caddis force the ball home in stoppage time to send Doncaster down instead.
Birmingham, relegated from the Premier League in 2011 just months after winning the League Cup, had seemed set to return to the third tier for the first time in 20 years.
They had begun the day in the bottom three and were always relying on results elsewhere to give them a chance of staying up - with their biggest hope being that Doncaster would lose at Leicester, meaning a point would be enough.
Helped by the vocal support of 3,500 travelling fans, they tried to take the game to their hosts but struggled to create chances in the first half.
Lee Novak saw two shots saved in quick succession by Andy Lonergan, but otherwise the Bolton keeper was largely untroubled.
Bolton also created little in a cagey first period but they took the lead after 57 minutes when David Wheater met a free-kick and Lee rifled an angled finish past Darren Randolph.
News that Doncaster had gone behind at Leicester brought hope - and cheers - from the travelling Blues fans but that was followed by despair when Jutkiewicz's shot squeezed past Randolph at his near post.
Birmingham were far from finished, however, and when Zigic headed home a Mitch Hancox cross it meant that, with Doncaster still trailing, Clark's side were again just one goal from safety.
The final few minutes of the 90 were agony for the away fans to watch, as Birmingham poured forward but could not find a way through Bolton's defence.
When six minutes of stoppage time were signalled, however, the Blues still had a chance and Caddis, who joined from Swindon earlier this season, emerged as their hero.
He was in the right place to nod home from close range after Zigic saw his header cleared off the line by Tim Ream, and wheeled away in delight to celebrate with his team-mates.
Blues manager Clark and his backroom staff dashed down the touchline to join them, and the final whistle brought more scenes of celebration - and relief - from the Blues' supporters.
Bolton boss Dougie Freedman:
"We felt we didn't perform anywhere near where we have been in the first half, I didn't think the energy wasn't there.
"In the second half we got off and running, went a couple of goals up and we didn't kill the game off. When you don't kill the game off in this division you give the opposition confidence.
"Because of the occasion it feels like Birmingham have won the league. But we've dropped points in too many games at home this season."
- 4MillsBooked at 70mins
- 31WheaterBooked at 61mins
- 27LeeSubstituted forKnightat 81'minutes
- 10BeckfordSubstituted forKellettat 86'minutes
- 11HallSubstituted forJutkiewiczat 61'minutes
- 17ReillySubstituted forMachedaat 60'minutes
- 36HuwsSubstituted forHancoxat 45'minutes
- 4RobinsonBooked at 56mins
- 7BurkeSubstituted forIbeat 60'minutes
- 19ZigicBooked at 90mins
- 31CaddisBooked at 90mins
- 12NovakBooked at 90mins
- Iain Williamson
- Shots on Target
Second Half ends, Bolton Wanderers 2, Birmingham City 2.
Corner, Bolton Wanderers. Conceded by Jonathan Spector.
Attempt blocked. Lukas Jutkiewicz (Bolton Wanderers) left footed shot from outside the box is blocked. Assisted by Neil Danns.
Paul Caddis (Birmingham City) is shown the yellow card for excessive celebration.
Goal! Bolton Wanderers 2, Birmingham City 2. Paul Caddis (Birmingham City) header from very close range to the top right corner.
Attempt blocked. Nikola Zigic (Birmingham City) header from very close range is blocked. Assisted by Federico Macheda with a headed pass.
Attempt blocked. Jordon Ibe (Birmingham City) right footed shot from the left side of the box is blocked. Assisted by Lee Novak with a cross.
Attempt missed. Neil Danns (Bolton Wanderers) right footed shot from the right side of the box is too high. Assisted by Andy Kellett following a fast break.
Hand ball by Liam Trotter (Bolton Wanderers).
Attempt blocked. Jay Spearing (Bolton Wanderers) right footed shot from outside the box is blocked.
Foul by Federico Macheda (Birmingham City).
Andy Kellett (Bolton Wanderers) wins a free kick in the attacking half.
Attempt saved. Jay Spearing (Bolton Wanderers) right footed shot from outside the box is saved in the centre of the goal. Assisted by Zat Knight with a headed pass.
Attempt saved. Lukas Jutkiewicz (Bolton Wanderers) left footed shot from the left side of the box is saved in the centre of the goal. Assisted by Andy Kellett.
Attempt blocked. Tom Adeyemi (Birmingham City) right footed shot from outside the box is blocked. Assisted by Jordon Ibe.
Substitution, Bolton Wanderers. Andy Kellett replaces Jermaine Beckford.
Attempt missed. Paul Robinson (Birmingham City) header from the centre of the box misses to the left. Assisted by Jordon Ibe with a cross following a corner.
Corner, Birmingham City. Conceded by Tim Ream.
Attempt saved. Tom Adeyemi (Birmingham City) right footed shot from outside the box is saved in the bottom left corner. Assisted by Lee Novak.