Cardiff needed extra-time to beat 2008 FA Cup final opponents Portsmouth 2-1 and reach the second round of the Carabao Cup.
Pompey had won the last cup meeting between the two sides on the biggest stage of all and looked as if they might repeat that triumph when Bluebirds captain Sean Morrison scored a 32nd-minute own goal.
But substitute Nathaniel Mendez-Laing equalised before Greg Halford's 113th-minute strike prevented a penalty shoot-out.
Cardiff started brightly with Matthew Kennedy probing down the right and Danny Ward's shot deflected wide.
But Portsmouth gradually got a foothold and the impressive Kyle Bennett twice tried his luck from distance without locating the target.
Kennedy created the clearest chance of the opening half-hour but Ward could not generate enough power on the header and Luke McGee comfortably collected in the Pompey goal.
Cardiff, however, were behind moments later as Morrison failed to deal with Kal Naismith's cross and diverted the ball past a helpless Brian Murphy.
Naismith soon fell under Bruno Manga's challenge and demanded a penalty but referee Stephen Martin waved play on.
Cardiff showed more intent after the break and were almost level within seconds when McGee pushed Manga's header on to the crossbar.
But Cardiff were level two minutes later when Kennedy burst down the left and the ball fell to Mendez-Laing to open his Bluebirds account following his summer move from Rochdale.
Murphy remained alert to deny Gareth Evans and Danny Rose and force extra time and the decisive goal came when Halford met Junior Hoilett's corner and beat McGee.