Birmingham City have appointed former Charlton boss Lee Bowyer as head coach, just minutes after confirming that Aitor Karanka had stepped down.
Karanka, 47, had been in charge of Blues for less than eight months.
Bowyer, 44, who resigned from his job with the Addicks on Monday, has signed a deal until June 2023.
Saturday's 3-0 loss to Bristol City was Blues' 12th home defeat of the campaign and left them just three points clear of the Championship relegation zone.
But Birmingham have also played four more games than 22nd-placed Rotherham and have 10 fixtures left this season - including a meeting with the Millers on 18 April.
Blues released a short statement on Tuesday confirming that Karanka had "stepped down" and that "further information would be provided in due course".
Within 15 minutes, they then confirmed the return of former Birmingham midfielder Bowyer, who left The Valley after nearly three years at the League One club - including relegation from the Championship eights months ago.
'I've got to lift everybody'
"I'm absolutely delighted and it's great to be back," said Bowyer.
"I've already seen some of the old faces from when I was here last and I'm just really looking forward to getting to work.
"My priority is to lift everybody. Not just the players, the staff as well. It seems like it's not been in a very good place, so I've got to lift them.
"I've got to try to implement what I want very quickly. The team will improve, I have no doubt about that but we already have a good base to work with."
Bowyer's first game in charge is scheduled to be on Wednesday at home to fifth-placed Reading, who Blues have already beaten this season.
Ex-Middlesbrough and Nottingham Forest boss Karanka, who succeeded Spanish compatriot Pep Clotet last July, leaves after 38 league and cup games in charge - none of which Blues fans were able to attend.
The decision to replace former Real Madrid player Karanka with Bowyer means that City owners Trillion Trophy Asia have now appointed their eighth manager since taking control of the club in October 2016.
Blues are in their 10th season in the Championship, following relegation from the Premier League in 2011, the same season they beat Arsenal to win the League Cup at Wembley, the club's greatest honour - a team that new boss Bowyer was part of.
In that time, they have finished in the Championship top 10 just three times, once under Chris Hughton, when they reached the play-offs in 2012, and twice under Gary Rowett, in 2015 and 2016 - and they have endured relegation battles in five of their 10 seasons back at second-tier level.
Karanka's departure 'had become inevitable'
Analysis - BBC Radio WM's Richard Wilford
Given the warmth of the reception by the fans both to the dismissal of Aitor Karanka and the selection of Lee Bowyer, everyone is just relieved to get it all finally done and there's now a lot of positivity.
As far as I understand it, there weren't any complications, just negotiating severance and tying up the loose ends on a manager who has left another club to take over.
With Bowyer's contract going through to June 2023, there is some forward planning going into this. What they haven't done is go down the lines again of appointing someone on a short-term deal, give them a whopping bonus if they stay up, then find out they might have to change direction again.
The appointment of Aitor Karanka was well intentioned as Blues tried to shake themselves free of a long-running cycle of hiring-and-firing and relegation scraps. However, his time in charge at St Andrew's never gathered any momentum, and his departure had become inevitable.
The raft of new signings brought in during the close season largely failed to make any impact, and certainly did little to cure the club's glaring weaknesses - woeful home form and fragile confidence. Karanka's natural caution brought those problems into sharp focus, City became even more goal-shy and one error would often be enough to lead to another defeat.
After 38 games in charge it remained difficult to define what Karanka's Blues were. Regular tweaks of system and personnel left supporters, and increasingly some players, pretty confused. Fans had long since turned. His final game, another error-prone home reverse against Bristol City, left Karanka looking drained and defeated.
What you will now get is a much more organised team, much more moulded to the players he's got, to reflect the passion and work ethic Lee Bowyer brings to football. He will have to hit the ground running but his appointment gives them a very reasonable chance of staying up. It would not take too many wins to put some pressure on Rotherham.