The fired-up home side made a stunning start to the league fixture as man-of-the-match Manoa Vosawai crashed over for an early try.
Connacht hit back with a well worked scores from scrum half Ian Porter and Number Eight Eoin McKeon before the teams exchanged kicks as Connacht led 13-10 at the break.
It was James who turned the game on its head when he scored a superb try to wrestle back the lead before a kicking duel set the game up for a thrilling finale.
And it was Cardiff Blues who dug deep in a frantic final few minutes to hold firm and spark celebrations on the final whistle as the home side rediscovered that winning feeling.
Head Coach Danny Wilson made five changes to his starting line-up with Rhys Patchell and Alex Cuthbert returning to the fold while Macauley Cook, Ethan Lewis and Jarrod Hoeata came into the pack.
Young fly half Evans was immediately into the game on his first league start at BT Sport Cardiff Arms Park as he cut inside two men from a low grubber kick in behind from Tiernan O’Halloran and an early penalty allowed Patchell to kick for touch.
Hungry for work Tom James smashed into contact down the left before quick hands released a marauding Vosawai down the right wing as the home side looked to dominate the early stages.
Wing James again broke tackles as he latched onto Patchell’s inside flicked pass to win a penalty when Connacht failed to release. Cardiff Blues kicked to the corner and the lineout drive was duly smashed over by a powerful Vosawai who rolled out of tackles to burst over for the try.
Connacht, though, hit back with a score of their own on 14 minutes as a period of sustained pressure, after the home side conceded a five-metre scrum, saw scrum half Porter score in the corner after a neat step and reach over the whitewash.
The Irish league leaders were growing in confidence as the first half wore on as they repeatedly looked to punch holes in attack and hit the game line at speed as Cardiff Blues were forced to dig deep in defence.
Referee Andrew Brace handed Connacht field position and a five-metre lineout after he awarded a penalty at the breakdown.
And the well-oiled leaders took full advantage of the call as they drove the rolling maul over for a second try of the night. Porter hit the right hand post for the second successive conversion attempt as Connacht led 10-7.
A Patchell penalty levelled the scores just before the half hour mark, this time after a big home scrum, but within two minutes a sweetly struck kick from scrum half Porter put Connacht back ahead.
Connacht were winning the territory battle until livewire Samoa centre Rey Lee-Lo wrapped up his opposite number and forced a counter attack as he flicked a pass out the back door to Lloyd Williams to charge up field.
A high tackle on the all-action Vosawai allowed Patchell to kick to the corner once more, but this time Connacht were wise to the drive and cleared the danger to lead 13-10 at the interval.
Connacht continued to look a threat with the ball in hand in the second half as Matt Healy broke from deep.
Defensive lynchpin Lee-Lo looked to make things happen with some big tackles before a penalty, after Gavin Evans thumped up the middle with a trademark punishing run, saw Patchell agonisingly push the resulting kick wide left of the target.
A double change saw James Down and Kristian Dacey brought on to add fresh firepower to the pack with just under half an hour left in the game.
And almost immediately a reversed penalty decision, after an off the ball scuffle, caused Connacht major issues.
The home forwards crashed up close to the line before the ball was spun wide and into the arms of James who showed all his predatory instincts to blast into two men and reach out to ground the ball. Patchell added the extras for a 17-13 lead.
A monster penalty kick from Patchell - from just inside the Connacht half - extended the lead until Carty nudged one over himself to leave the game on a knife-edge at 20-16 with 13 minutes left.
Replacement Dan Fish inserted some pace to the game as he kicked in behind to find space and forced O’Halloran to chase back as the roars inside the stadium continued to grow as did the and tension.
Danger man Aki again broke from deep to send home hearts into their mouths before Connacht kicked to the corner and looked to drive over. The forwards rumbled up and the TMO was called upon before awarded a knock-on against the Irish side.
A tense and exhausting final few minutes duly unfolded as Connacht threw everything they had at Cardiff Blues, but the home side would not buckle and be denied with Lloyd Williams kicking the ball out to hear the final whistle and record a second win of the league season.
Timeline:
07m Vosawai t Patchell c 7-0
14m Porter t 7-5
23m McKeon t 7-10
26m Patchell p 10-10
27m Porter p 10-13
55m James t Patchell c 17-13
64m Patchell p 20-13
67m Carty p 20-16
Cardiff Blues: 15 Rhys Patchell, 14 Alex Cuthbert, 13 Rey Lee-Lo, 12 Gavin Evans, 11 Tom James, 10 Jarrod Evans (Fish 57), 9 Lloyd Williams; 1 Gethin Jenkins (Hobbs 62), 2 Ethan Lewis (Dacey 51), 3 Taufa’ao Filise (Mitchell 59), 4 Jarrod Hoeata, 5 Lou Reed (Down 51), 6 Macauley Cook, 7 Josh Turnbull, 8 Manoa Vosawai (Dolan 77)
Replacements: 16 Kristian Dacey, 17 Sam Hobbs, 18 Craig Mitchell, 19 James Down, 20 Cam Dolan, 21 Tavis Knoyle, 22 Garyn Smith, 23 Dan Fish