Birmingham confirmed their Sky Bet Championship status for another season with a 3-1 victory at Rotherham which left the home side deep in the relegation fight.
Jacques Maghoma, Jota and Kerim Mrabti scored the second-half goals which earned the win after Matt Crooks had given Rotherham the lead midway through the first half.
The win took Garry Monk's side on to 50 points, 10 clear of Rotherham in the final relegation spot with two games of the season remaining.
But while Monk can now look to a summer of rebuilding after his club were docked nine points for breaching profitability and sustainability rules, Paul Warne faces difficult games with West Brom and Middlesbrough as Rotherham try to bridge the three-point gap to Millwall – who have a game in hand over the Millers.
Birmingham forced a third minute corner but Michael Morrison headed over at the far post from Maghoma's delivery.
Two minutes later Che Adams won a free-kick to the right of the home area but when a low ball from Jota found the Birmingham striker his shot was comfortable for Marek Rodak.
But the home side took the lead after 22 minutes when a low ball by Ryan Williams was cleared by Morrison only as far as Crooks.
He shot low into the bottom corner from 12 yards with the Birmingham captain claiming the Rotherham player had controlled the ball with his arm.
The Millers came close to a second goal with 10 minutes of the half remaining as Joe Newell's corner was headed goalwards by Semi Ajayi and the rebound was fired over by Vaulks from close range.
Lukas Juktiewicz shot wide after being played in by Jota in a rare Birmingham attack. The visitors forced successive corners just before the break but, from the second, Gary Gardner's header was wide of the target.
Birmingham started the second half in determined mood and levelled after 56 minutes as Maghoma fired home from inside the area after taking a pass from Jota and running at a crowded defence before firing across Rodak and into the corner.
Rodak kept out a Jutkiewicz shot at his near post just after the hour was Birmingham looked for a second.
It came shortly after as Adams skipped past Richard Wood and crossed low for Jota to pick his spot and guide the ball into the bottom right corner.
Harlee Dean blocked bravely as Richie Towell shot from the edge of the area with 15 minutes to go as Rotherham continued to battle for their Championship survival.
Camp was then forced to push the ball over the bar after it bounced in the area from an Ajayi header with 12 minutes remaining.
Deep into the five minutes of stoppage time Birmingham wrapped up the win as substitute Mrabti scored his first goal for the club, firing low under Rodak after being fed by Maghoma.
ga('create', 'UA-72310761-1', 'auto', {'name': 'pacontentapi'});
ga('pacontentapi.set', 'referrer', location.origin);
ga('pacontentapi.set', 'dimension1', 'By Roddy Brooks, Press Association Sport');
ga('pacontentapi.set', 'dimension2', '2a5baa63-7188-47ea-ad05-ca4fc7225cfd');
ga('pacontentapi.set', 'dimension3', 'paservice:sport,paservice:sport:club-news,paservice:sport:football,paservice:sport:match-reports');
ga('pacontentapi.set', 'dimension6', 'story');
ga('pacontentapi.set', 'dimension7', 'composite');
ga('pacontentapi.set', 'dimension8', null);
ga('pacontentapi.set', 'dimension9', 'sport:football');
ga('pacontentapi.send', 'pageview', { 'location': location.href, 'page': (location.pathname + location.search + location.hash), 'title': 'Birmingham seal Championship safety as Rotherham remain on the brink'});