Cardiff manager Malky Mackay was delighted with his side's display as they secured victory at home to Portsmouth thanks to a stoppage time winner from Craig Conway.
Kenny Miller handed City the advantage, but Pompey equalised seven minutes before half-time through Marko Futacs.
The visitors then went in front four minutes after the break, with Greg Halford scoring before Mark Hudson levelled for the hosts and Conway struck in the second minute of second-half stoppage time to ensure a vital win for the Bluebirds to close the gap on second-placed Southampton.
Mackay said: "It was a well-deserved victory. The first 35 minutes was some of the best stuff we've played for a while.
"We created chances, had three one-on-ones, scored a fantastic goal and, although Marshy made the error, there was a calmness going into the second half.
"Portsmouth are a big, physical team and we knew they would cause us problems from set-pieces.
"We won the first header, but the ball broke lovely to their player and we found ourselves 2-1 down 10 minutes into the second half. But we survived that period.
"We kept believing and playing and I was absolutely delighted with the mentality of the players.
"We showed great mental toughness and character. We played well and I felt the goals would come.
"We were bright and alive. Craig set up one and scored another but both came from set-pieces which we took quickly. We worked hard for things today."
Meanwhile, Portsmouth boss Michael Appleton was left disappointed with the last-gap defeat, saying: "It's not nice to lose in the 93rd minute but I'm more frustrated and disappointed by the fact we switched off from a quick throw-in and free-kick for the second and third goals.
"We have a saying which we tell the players all the time that when the ball goes dead, we come alive. But that didn't happen today.
"In saying that, I can't complain with the result. It is no fluke where Cardiff are in the league or the fact they are in the semi-finals of the Carling Cup."