Danny Wilson’s men trailed 17-6 early in the second-half but displayed unwavering grit and determination to complete a stunning comeback.
First a series of offloads from the floor sent man-of-the-match Sion Bennett over on 61 minutes and with the door ajar Lloyd Williams pounced from a stunning opportunist score.
Edinburgh hammered away at the death but the Blues’ character shone through after they soaked up phase after phase to secure a one-point win.
The victory keeps the Blues’ hopes of a top six PRO12 finish alive with Munster the visitors to BT Sport Cardiff Arms Park next weekend.
Cardiff enjoyed plenty of possession in the opening exchanges and took the lead on six minutes thanks to the boot of Steve Shingler, after Edinburgh failed to roll away at the breakdown.
That sparked the hosts into life and while they were restrained to the middle of the pitch, a penalty saw them launch a sustained period of possession and pressure.
They kicked to the corner and although the Blues defended well, George Earle was harshly penalised for pushing Sam Hidalgo-Clyne after he was dragged by the collar out of the maul.
Again they went to the corner but a penalty was quickly forthcoming, with referee David Wilkinson sending Anton Peikrishvili to the sin-bin for side entry.
Back to the lineout the Scots went and despite bringing the driving lineout to halt for a long period, the Blues maul defence eventually cracked and Edinburgh piled over with Neil Cochrane the scorer.
Hidalgo-Clyne knocked over the extras but Shingler quickly responded and the Blues soon threatened on the attack.
Some smart off-loading interplay between Matthew Morgan, Alex Cuthbert and Willis Halaholo made inroads but two phases later they were penalised and Edinburgh cleared.
The Edinburgh scrum-half was then narrowly short with a long-range penalty attempt and the Blues worked their way back into mid-field.
A perfectly-weighted, low kick from Morgan then pinned the Scots into their twenty-two and when Cochrane threw crooked the Blues were presented with a gilt-edged chance.
Cuthbert hit a short pass from scrum-half Williams at full-pace and steamrolled through Jason Tovey, but he was caught by the inside defence.
The Blues remained in the ascendant but Edinburgh continued to frustrate the visitors and spoiled the breakdown, forcing a knock-on as the scores remained 7-6 at the break.
With a strong wind picking up in the second-half, the Blues put themselves on the racks when Kristian Dacey’s throw was blown off course.
Off the ensuing scrum it appeared as though Chris Dean had burst through the tackle but after being brought to the floor he failed to release the ball and play was brought back.
But the Scottish province soon secured the try they were searching for after they broke right from a scrum with Rory Scholes receiving the ball from set-play and easing around Morgan for a score in the corner.
Hidalgo-Clyne fired wide from the touchline but the try had stretched the hosts lead to 12-6. Another sustained period of pressure led to Scholes crossing for his second on 55-minutes, stretching his side’s lead to 11-points.
It appeared ominous for Wilson’s side but on 60-minutes they struck with their first try. Lloyd Williams sniped round the fringes and offloaded round the back to Jarrad Hoeata.
The New Zealand second-row galloped into the Edinburgh twenty-two and came agonisingly close to crossing before being hauled down.
But a pair of offloads off the floor first to Nick Williams and then Bennett saw the flanker cross for his second try in as many weeks.
Shingler slotted the simple conversion to cut the deficit to 17-13 with 20 minutes to play. The Blues continued to battle and they worked their way back into the red zone.
They hammered away at the hosts for phase after phase and despite stretching the defence from left to right they could not manufacture a breakthrough.
That was until scrum-half Williams, with the luxury of advantage, dinked a speculative chip over the top. The bounce defied Glenn Bryce and the scrum-half pounced under the posts.
Shingler’s conversion was charged down, setting up a tense finale but the Wilson’s men held firm to secure the spoils.