Cardiff booked their place in the FA Cup fifth round for the first time in 14 years after seeing off League Two side Hereford at Edgar Street.
Theo Robinson and Roger Johnson battle for possession
Kevin McNaughton scored his first ever goal for the Bluebirds with a superb volley on the stroke of half-time.
And he was on hand again midway through the second half to win a penalty which Steve Thompson converted.
Theo Robinson pulled one back with a shot into the bottom-left corner, but the hosts could not find an equaliser.
Hereford, 44 places below Cardiff and hoping to reach the fifth round for the first time in their history, were under pressure from the start.
Keeper Wayne Brown was quickly called into action and pulled off a fine save from Paul Parry.
But the hosts showed early on that they were up for the battle too and Trevor Benjamin drove his first effort just over the bar from a narrow angle.
Both sides looked to create chances but neither could really find anything else clear-cut.
That was until McNaughton raced into the box from Peter Whittingham's through-ball, only for him to fire it into the side-netting.
Robinson, on loan from Watford, then had Hereford's best chances midway through the first half.
First, he drove from outside the box forcing Michael Oakes to push the ball out for a corner.
And moments later, he got behind the Cardiff defence and fired his shot into the net, but on the wrong side of the post.
The Bluebirds continued to pose a threat and it took a brilliantly-timed challenge from Richard Rose to block Parry's goal-bound effort.
But they got the breakthrough in first-half injury time when McNaughton's superb volley from the edge of the box left Brown stranded.
Like the first period, Hereford came out looking to get something out of the game and Lee Collins came close but flicked his header into Oakes' arms.
Cardiff, though, were finding more space in attack and on 65 minutes, doubled their lead.
McNaughton raced into the box again and was felled by Clint Easton. Thompson sent Brown the wrong way from the spot.
Cardiff were looking comfortable until Robinson pulled one back with his 13th goal of the season with 14 minutes to go, firing low past Oakes.
Joe Ledley hit the bar late on as the Championship side looked to make sure of the win but, down the other end, Oakes had to make great saves at the death from Toumani Diagouraga and Simon Johnson to prevent the equaliser.
Hereford manager Graham Turner:
"We were disappointed with aspects of our play early on, I think we'd be fair to say we've been beaten by a good Cardiff side.
"It was probably the worst time for us to concede a goal just before half time, but the pleasing aspect from our point of view was the last 20 minutes we really had a go.
"If had been another day with a little bit of luck, we might have got a draw out of it."
Cardiff manager Dave Jones
"At 2-0 maybe we thought the game was over, but we gave them hope and that's cup football for you sometimes.
"We could have made it easier by doing the right things that we'd done for the 80-odd minutes but we wouldn't be Cardiff if we didn't do that.
"It was always going to be difficult and the main thing was that we didn't become the upset of the day."
Hereford: Brown, McClenahan, Beckwith, Collins, Rose, Johnson, Smith, Diagouraga, Taylor (Easton 65), Benjamin (Gwynne 71), Robinson.
Subs Not Used: Ingham, McCombe, Palmer.
Goals: Robinson 77.
Cardiff: Oakes, McNaughton, Johnson, Loovens, Capaldi, Whittingham, McPhail, Rae, Ledley, Parry, Thompson (Hasselbaink 88).
Subs Not Used: Enckelman, Purse, Ramsey, Blake.
Goals: McNaughton 45, Thompson 67 pen.
Ref: Andy D'Urso (Essex).
BBC Sport Player Rater man of the match: Cardiff's Kevin McNaughton. Please note that you can still give the players marks out of 10 on BBC Sport's Player Rater after the match has finished.