On-loan Palace striker Sullay Kaikai struck twice late on to cancel out Peter Whittingham's first-half penalty and an 89th-minute Kenneth Zohore goal that looked like being the winner.
But the main focus was on referee Simon Hooper, who incensed the Griffin Park crowd by awarding Cardiff a 22nd-minute spot-kick and then dismissing three clear-cut penalty calls for the hosts.
Whittingham gave Cardiff the lead from the spot following an innocuous-looking coming-together between Sean Morrison and Brentford defender Andreas Bjelland in the box.
Brentford huffed and puffed for an equaliser and it came with seven minutes remaining when 21-year-old Kaikai cut inside from the left and smashed an unstoppable dipping drive in off the far post.
But Zohore looked like having the final say when he raced clear on 89 minutes and overpowered defender Tom Field to toe poke home beneath the onrushing Daniel Bentley.
Brentford felt hard done by and came roaring back to break Neil Warnock's heart when defender John Egan charged down the right and crossed for Kaikai to deftly head the ball in at the far post.
It was no more than the Bees deserved for a rejuvenated second-half display which saw the home crowd fuming at a string of penalty appeals waved away by the official in the middle.
Scott Hogan was twice bundled over in the box by Cardiff defender Morrison, the second a clear shove in the back as both men challenged for the ball.
Bees defender Harlee Dean picked up a booking for dissent after a third penalty appeal, when a Brentford shot was palmed clear by a defender's hand.
Lacklustre Brentford had little response to Warnock's revitalised Bluebirds in a subdued first half and might have gone further behind before the break.
Morrison had a goal ruled out for offside minutes later and Zohore should have stretched Cardiff's lead when he burst clear of the defence only to be thwarted by a full-stretch Bentley save.
The hosts started the game brightly enough, leading scorer Hogan crossing for Lasse Vibe whose first-time effort at the near post was deflected wide by keeper Brian Murphy.
Romaine Sawyers stung the City keeper's hands with a sizzling low drive before Hogan forced him to tip over from a right-wing cross seconds later.
Bjelland saw a rising drive flash over the far corner on 15 minutes, but when Cardiff took the lead it knocked the stuffing out of the Londoners.
The hosts looked devoid of ideas and lacked any invention against a physical and motivated City side built very much in Warnock's image.
Brentford looked far livelier after the break and only two full stretch saves from Murphy to deny first Ryan Woods and then Egan kept them in it.
Source : DSG