Match ends, Cardiff City 4, Birmingham City 2.
Joe Ralls' hat-trick helped Cardiff City to victory over Birmingham City in a contest that ended with both sides reduced to 10 men.
Cardiff's Danny Ward was sent off in the 52nd minute when the score was 2-1, while Harlee Dean was red carded for Blues in stoppage time.
Kristian Pedersen put Birmingham ahead, but a contentious Ralls penalty and Curtis Nelson's goal turned the game on its head before Ralls' curler gave the Bluebirds a cushion.
Ivan Sunjic's goal set up a Grandstand finish but a second Ralls spot-kick in injury time sealed victory.
Cardiff remain 14th in the Championship, one point and two places below Birmingham.
Heading into this contest no side had scored fewer goals on the road in the Championship than Birmingham City and a lack of cutting edge could not have been more apparent in the first quarter of the match when they were utterly dominant as Cardiff's Swansea hangover was abundantly clear.
The visitors registered nine shots on goal before the Bluebirds' contentious penalty and will wonder how they were not able to carve out a lead greater than 1-0. Such was their dominance that Bluebirds fans started chanting "sort it out" towards boss Neil Warnock midway through the first half.
Blues started on the front foot and kept coming at Cardiff, with the impressive Dan Crowley the orchestrator.
They led after three minutes through a simple goal, with Pedersen poking home after Neil Etheridge saved Lukas Jutkiewicz's header from a Fran Villalba free-kick, but was only able to parry it into the path of Kerim Mrabti.
The goal sparked the visitors and Jude Bellingham should have done better from a fine cross than blazing over the bar from close range.
Crowley then hit the inside of the post with Etheridge beaten, with the home goalkeeper lucky not to concede an own goal as the ball struck his back and bounced to safety.
However, Etheridge atoned with a splendid save to tip over Jutkiewicz's powerful near-post shot as Birmingham failed to extend their lead.
Cardiff had not created an effort before Danny Ward turned a Nathaniel Mendez-Laing cross just wide on 26 minutes, but they levelled soon after thanks to the first of two penalties.
Referee Andrew Madley pointed instantly to the spot when Dean was adjudged to have pulled the shirt of Aden Flint, but the Birmingham players were extremely unhappy with the decision and the infringement was tough to spot.
The goal inspired Cardiff and they led when Nelson bundled home at the second attempt from close range after Lee Camp could only block Flint's towering header.
The visitors were rocked and Camp had to tip over Junior Hoilett's powerful effort to prevent them falling further behind, while Nelson saw a goal ruled out just after the break after Flint was penalised for his own shirt tug.
However, Ward's reckless lunge on Mrabti saw the momentum swing away from the hosts with 38 minutes left to play, with Birmingham looking to find parity.
But a sucker-punch on the counter-attack ended their resilience, with Mendez-Laing's powerful run culminating in a pass to Ralls, who curled home exquisitely.
The goal deflated Birmingham, who have now failed to win on their last seven trips to the Welsh capital, but they did manage a consolation goal when Sunjic lashed home from 20 yards.
However, their momentum was squandered when Dean was sent off for leading with an elbow in a challenge on Ralls and Cardiff made the points safe when Ralls slotted home a second penalty after Marc Roberts fouled sub Omar Bogle.
What they said
Cardiff City manager Neil Warnock told BBC Sport Wales:
"The lads were really nervous to start with, I am tremendously proud of the character they showed, they knew how bad they were at Swansea. The only way to get the fans back in favour was to show how much it means to us and we did that, I am so proud of them all.
"I was chanting with the fans 'Warnock sort it out' I was thinking, 'come on, get a grip' so I am pleased I managed to sort it out as we have a great group of fans and you couldn't blame them for being upset last week.
"When we play well there are not many better teams than us in the division… so the season starts now really.
"It is one of the best wins since I have been at the club, under the circumstances. You could see how nervous the players were… We had to put a performance on for the fans and we did. They stayed and saluted us even though they must have been wet through."
Birmingham City's caretaker head coach Pep Clotet said:
"It was a game with a little bit of everything, a lot of emotions and intensity.
"For us, we feel that we leave Cardiff without receiving what we deserved.
"Cardiff had all the luck when it comes to transforming those chances and we didn't. We knew it was a very difficult game for us… but the players played the way we want to play.
"In total we had 25 shots on goal and still only managed to score two goals. It is a platform for us, but we need to learn to put a game to bed as soon as we can. All the opportunities Cardiff had in the game they took. But the first half is how we all want to see Birmingham City play.
"I will watch the Harlee Dean red card again, but we will consider an appeal."
- 2PeltierBooked at 90mins
- 16NelsonSubstituted forBambaat 85'minutes
- 19Mendez-LaingSubstituted forPatersonat 80'minutes
- 23WardBooked at 52mins
- 33HoilettSubstituted forBogleat 75'minutes
- 4RobertsBooked at 90mins
- 12DeanBooked at 90mins
- 7CrowleySubstituted forBaileyat 80'minutes
- 22BellinghamSubstituted forGiménezat 69'minutes
- 34SunjicBooked at 32mins
- 17Villalba Rodrigo
- 10JutkiewiczBooked at 85mins
- 18MrabtiSubstituted forMaghomaat 65'minutes
- Andy Madley
- Shots on Target
Second Half ends, Cardiff City 4, Birmingham City 2.
Goal! Cardiff City 4, Birmingham City 2. Joe Ralls (Cardiff City) converts the penalty with a left footed shot to the bottom left corner.
Marc Roberts (Birmingham City) is shown the yellow card for a bad foul.
Penalty conceded by Marc Roberts (Birmingham City) after a foul in the penalty area.
Penalty Cardiff City. Omar Bogle draws a foul in the penalty area.
Lee Peltier (Cardiff City) is shown the yellow card.
Harlee Dean (Birmingham City) is shown the red card.
Foul by Harlee Dean (Birmingham City).
Joe Ralls (Cardiff City) wins a free kick in the attacking half.
Foul by Lukas Jutkiewicz (Birmingham City).
Sol Bamba (Cardiff City) wins a free kick in the defensive half.
Goal! Cardiff City 3, Birmingham City 2. Ivan Sunjic (Birmingham City) right footed shot from outside the box to the bottom left corner following a corner.
Corner, Birmingham City. Conceded by Omar Bogle.
Attempt blocked. Fran Villalba (Birmingham City) right footed shot from the right side of the box is blocked.
Attempt blocked. Marc Roberts (Birmingham City) right footed shot from the left side of the box is blocked. Assisted by Odin Bailey.
Corner, Birmingham City. Conceded by Neil Etheridge.
Attempt saved. Jacques Maghoma (Birmingham City) right footed shot from a difficult angle on the right is saved in the centre of the goal. Assisted by Lukas Jutkiewicz.
Corner, Birmingham City. Conceded by Marlon Pack.
Attempt blocked. Maxime Colin (Birmingham City) right footed shot from the centre of the box is blocked.