Match details from BBC SportCardiff City eased into the third round of the Capital One Cup but their win at Accrington Stanley was marred by a worrying injury to Andreas Cornelius.
The Denmark striker, a £7.5m summer buy from Copenhagen,crumpled under a heavy tackle and was carried off.
His replacement, Rudy Gestede, made the most of his chance, adding a calm finish to Jordon Mutch's cross.
Nicky Maynard had opened the scoring with a fine piece of skill, flicking over the defence before firing home.
Cardiff's reward for beating Accrington is a third round tie away at West Ham United, their conquerors on the opening day of the Premier League season.
While Cardiff boss Malky Mackay will be pleased his side have progressed in the competition, his major concern will be the injury to Cornelius.
The 20-year-old was top scorer in the 2012-13 Danish Superliga, scoring 18 goals in 32 appearances, but his pre-season was curtailed by an ankle problem.
Mackay confirmed after the match that Cornelius has suffered an ankle strain and will miss Saturday's home league game against Everton, but the striker will have a scan on Thursday to further assess the damage.
It was hard luck on the Dane who had been handed his first competitive start of the season, as Mackay named a completely new starting XI from the one that shocked Manchester City in the Premier League on Sunday.
Club captain Mark Hudson also made his first start of the season.
Accrington gave a debut to goalkeeper Marcus Bettinelli, who has been signed on an emergency loan from Fulham to cover for the injured Ian Dunbavin.
The home side had knocked out Middlesbrough in the previous round, but were so weakened by injuries and the suspension of Danny Webber that manager James Beattie, the former England striker, had considered naming himself on the bench.
In the end Beattie resisted the temptation to reprise last season's role on the pitch, but his side could have done with his eye for goal.
Kal Naismith did get a shot at goal in a turgid opening half-hour, but it was straight at Cardiff goalkeeper Joe Lewis who gathered the ball at the second attempt.
Instead it was Cardiff who came closest to scoring, as centre-back Hudson had his set-piece header cleared off the Accrington goal-line by Luke Joyce.
The half ended on a sour note for the Premier League side as Cornelius went down under a heavy block-tackle clutching his left ankle.
A stretcher was summoned to take the stricken Dane to the sidelines and Gestede came on to replace him.
There was greater attacking intent after the break and home striker Will Hatfield wasted no time in letting loose a shot in the area, only to see it deflected behind by Kevin McNaughton.
But Cardiff dashed the League Two side's hopes with two spectacular goals within 90 seconds.
First Maynard flicked the ball over his marker, spun away in pursuit and hit the ball first time past a helpless Bettinelli in the Accrington goal.
Accrington had barely absorbed the set-back before they found themselves two down, as Mutch strode through a gap before crossing for Gestede to smash into the back of the net.
Cardiff boss Malky Mackay: "That could have been a potential banana skin tonight if we hadn't gone out and been professional.
"We knew they were going to try and pack the area and make it difficult for us. We had to keep shifting the ball from side to side and eventually little gaps open up, which is what happened.
"As the second half wore on we were increasingly influential and looked as if we were going to score."
Accrington manager James Beattie: "The lads are disappointed in there. There's no shame in that performance at all. I thought it was very good. All the units were working a lot better tonight, the shape was good, the discipline was good.
"They can hold their heads high. I would put it up there with the Middlesbrough performance [in the last round when Accrington won 2-1].
"Now we just need to replicate that Capital One Cup performance in the league and there'll be no problem whatsoever."
Source: Cardiff City Online