A record Celtic League crowd of 15,327 saw the Blues dent Leinster's title ambitions in a nine-try thriller at Cardiff's Millennium Stadium.
Blues (18) 40
Tries: Macleod, Phillips, Czekaj, J Robinson, Morgan
Cons: N Robinson (3)
Pens: N Robinson (3)
Leinster (17) 31
Tries: Horgan, D'Arcy, Hickie, Kearney
Cons: Contepomi (4)
Nick Macleod, Mike Phillips, Shane Horgan and Gordon D'Arcy traded tries as the Blues led 18-17 at half time.
Chris Czekaj and Denis Hickie then went over and Rob Kearney seemed to give Leinster victory before Martyn Williams and Craig Morgan clinched a Blues win.
Leinster are joint top with Ulster, who have two matches left to their one.
Ulster play the Scarlets in Llanelli on Friday, then face the Ospreys in Swansea on 26 May.
Leinster travel to face Edinburgh on the same day as the title race goes to the wire between the two contenders.
The Blues, playing at the stadium because a marquee for corporate guests for Saturday's FA Cup final was covering their Arms Park home ground, are up to third in the table and are guaranteed to finish as the leading Welsh region.
They opened the game at a furious pace, Robin Sowden-Taylor expertly winning ball on the floor to set up a Jamie Robinson burst.
The centre was hauled down, but the ball was recycled five metres from the Leinster line and fed to Macleod who crashed over for the opening try.
Nicky Robinson added two penalties before a Phillips clearance kick was charged down, gifting Leinster wing Horgan a try.
Phillips responded with a superb break from a ruck near half-way, the Wales scrum-half then stepping Girvan Dempsey to claim a memorable score.
Felipe Contepomi landed a 50m penalty for Leinster, before a poorly conceived Nicky Robinson chip from ball inside his own half was charged down.
Phillips looked to be back to cover, but the bounce deceived him and fell to D'Arcy for a try, Contepomi's conversion leaving the Blues with a one-point lead at the break.
Czekaj extended that on 49 minutes with the home side's third try, Marc Stcherbina's well-worked loop on the half-way line giving the young wing the space to sprint home.
The Irish fired straight back from turnover possession near the Blues line, the ball being fired to the wing where Hickie stepped Macleod superbly for the try.
Tempers then boiled over and John Yapp and Adam Byrnes were sin-binned for a fracas.
Robinson edged his side four points clear with a 65th-minute penalty, but a deft chip through from opposite number Contepomi swung the game back to Leinster.
With Horgan going for the try, the ball rebounded off the goal-post to deceive the Blues defenders, leaving substitute Kearney with an easy task to gather and score.
Back came the Blues with a full-blooded attack, Jamie Robinson's fine angle creating the space for supporting substitute Williams to claim the decisive score.
Morgan - in his 200th Cardiff/Blues and final home appearance before a summer move to Bristol - rounded off the points-fest in injury time with a try in the corner.
Leinster fly-half Felipe Contepomi:
"It was a marvellous game and the massive Cardiff crowd will go home happy, but it wasn't the result we wanted.
"On a dry day at this time of year you should expect a quick game from these two teams, we both like to play dynamic rugby.
"Ulster are definitely favourites for the title now - it's down to them and whether the Welsh sides facing them can do us a favour."
Blues man-of-the-match Jamie Robinson:
"That's one of the most intense games I've played in.
"It was dry, a great surface, and there's so much width out there.
"It's been a great week for me - I was so chuffed to get back in the Wales squad, it's been a few years out for me."
Blues: Macleod; Czekaj, J Robinson, Stcherbina, Morgan; N Robinson, M Phillips; Yapp, R Thomas, Jenkins; D Jones, Sidoli; Molitika, Sowden-Taylor, Rush.
Replacements: R. Powell for M. Phillips (79), Schubert for D. Jones (40), M. Williams for Molitika (67). Not Used: Nuthall, T. Davies, S. Roberts, Goodfield.
Leinster: Dempsey; Horgan, D'Arcy, Lewis, Hickie; Contepomi, Easterby; Corrigan, Jackman, Byrne; Byrnes, O'Kelly; Miller, Gleeson, Heaslip.
Replacements: Kearney for Lewis (64), Blamey for Jackman (40), Green for Byrne (40), Ronan for Miller (15). Not Used: Hepworth, O'Riordan, Gissing.
Referee: Rob Dickson (SRU)