Substitute Wilfried Bony spared Swansea's blushes as his second-half double saw the Welsh club come from behind at Birmingham to secure a place in the fifth round of the FA Cup.
The Swans' poor recent run looked set to continue when Lee Novak's glancing header gave Birmingham a deserved lead.
But the introduction of Bony at the interval changed the game, with the Ivory Coast international scoring twice in three minutes to take his tally to 16 for the season and seal a 2-1 win.
Swansea's disappointing campaign had looked to be heading for its nadir after a woeful first half, but victory means they can approach Tuesday's key Premier League fixture against Fulham with a positive result behind them.
It had been a far from ideal build-up for Swansea with a run of eight games without a win in the league being added to by a training ground row between Chico Flores and Garry Monk and reports of divisions within Michael Laudrup's squad.
Glowering skies and a fierce hailstorm minutes before kick-off did not appear to be a good omen and so it proved as the Swans turned in a rudderless first-half display.
In the opening seconds Ashley Williams had to clear a threatening ball from Blues debutant Albert Rusnak after Alejandro Pozuelo gifted Chris Burke the ball.
It was little surprise when they fell behind in the 15th minute. Burke whipped in an inviting cross and Novak glanced an excellent header beyond Gerhard Tremmel's despairing dive.
It could have been 2-0 three minutes later. Tremmel saved a Rusnak shot but released the ball as he was set to slide out of play on the sodden surface, allowing Shane Ferguson to get in an effort on goal which Williams cleared.
Swansea rallied as Pablo Hernandez volleyed over before Alvaro Vazquez wasted a great opportunity, getting on to a Pozuelo pass to round goalkeeper Colin Doyle but fire hopelessly wide.
Swansea frustrations began to boil over, with captain Williams making his feelings clear to both Vazquez and Pozuelo, particularly the former, in unseemly fashion.
Burke beat Flores with ease to get away an effort which rolled wide before Swansea spurned a great chance four minutes prior to the break.
Flores nodded down a Hernandez free-kick but Amat prodded over from inside the six-yard box.
Tremmel tipped over a Mitch Hancox effort in first-half stoppage time and the second half started little better for the visitors when Dwight Tiendalli's slack defending allowed Ferguson through, with Williams making a superb last-ditch tackle.
But Swansea began to enjoy a decent period of pressure around the hour mark, with Roland Lamah volleying a good chance against Bony, who had replaced Hernandez, before Hancox made a terrific tackle as the Ivorian went through on goal.
Bony's strength and movement was causing Birmingham all manner of problems and Doyle saved well at his near post from a fierce low shot.
And the £12million man got his reward by firing in the equaliser in he 67th minute.
Lamah's cross was at an awkward height but Bony despatched a left-footed volley beyond Doyle with authority.
Seconds later Lamah could have put them ahead only for Doyle to snatch the ball from his feet as the Belgian tried to round the keeper.
But there was no reprieve for the Blues in the 69th minute. Swansea broke through Lamah and Pozuelo's tee-up saw Bony shift away from the advancing Doyle and fire past the two defenders on the line to turn the game on its head.
The final 20 minutes did not pass without alarm, with Leon Britton clearing off his own line after Tom Adeyemi had surged into the Swansea box, but the visitors survived to advance.