Will Fish struck the winner on Tuesday (local time) with his first goal for League One side Cardiff at the Racecourse Ground in the 71st minute, slotting in at the back post.
With an eye on Friday's home game against Championship leaders Coventry, Wrexham manager Phil Parkinson made seven changes from the side that had started Saturday's 1-1 draw at Middlesbrough. It proved costly as Cardiff were the better team throughout.
Cardiff were first on the scoresheet when Omari Kellyman's shot was pushed away by Callum Burton, but Yousef Salech was there to slot home the rebound.
Wrexham drew level when Kieffer Moore headed home from close range in the 52nd minute, seven minutes after he came on, but the home side could not hold off Cardiff.
"I enjoyed the whole performance and for a young team like ours to deal with the equaliser and respond the way we did was very satisfying for us," Cardiff City boss Brian Barry-Murphy told Sky Sports.
"The nature of the club is an emotional roller-coaster - when we go well and are winning games it feels like nothing can stop us."
The tie was the first meeting of the sides in 21 years, a rivalry fuelled by the animosity of the traditional Welsh north-south divide, with Wrexham in the north, and the capital Cardiff in the south.
The clubs have had contrasting fortunes, with Wrexham having climbed to the second tier from non-league football in three seasons under the ownership of Hollywood A-listers Ryan Reynolds and Rob McElhenney.
Cardiff, however, were relegated to the third tier last season, having played in the Premier League as recently as 2019.
Fulham, meanwhile, were given a scare at Adams Park by Wycombe, a team 44 places below them in England's football pyramid.
Ex-Fulham man Cauley Woodrow scored in the fourth minute when he buried a shot from an angle inside the near post from 20 yards.
Eighteen-year-old Josh King equalised in the 48th minute with a clever flick into the net, but neither team could break the deadlock, sending the game to penalties.
Issa Diop smashed home the winning penalty to give Fulham a 5-4 victory in the shootout, with Fulham goalkeeper Benjamin Lecomte saving three spot kicks.
Brentford thrashed fourth-tier Grimsby Town 5-0 with goals from Mathias Jensen, Keane Lewis-Potter, Reiss Nelson, Fabio Carvalho from the penalty spot, and Nathan Collins.
There are five games on Wednesday to determine the other quarter-finalists, including holders Newcastle United at home to Tottenham Hotspur.