Rovers boss Grant McCann rang the changes, with an alteration in shape as well as personnel. And they made a quick start as they went in front after 15 minutes - Luke Molyneux getting to the byline and putting in a dangerous, low centre which skipper Owen Bailey tucked away from close range - his ninth of the campaign.
Bailey then blasted over in search of a second but that miss came back to haunt the visitors when Cardiff levelled. Omari Kellyman fired home from a central position after Isaak Davies burst past Sean Grehan and put in a wicked delivery.
And the hosts turned the game on its head as they went in front when Cian Ashford held off ample Rovers defenders, dashed half the length of the pitch and fired beyond Thimothee Lo-Tutala.
But the visitors summoned a comeback of their own when Cardiff-born Charlie Crew played a wicked through-ball into Brandon Hanlan and he fired home into the bottom-right corner.
Yousef Salech then propelled the hosts back in front. He initially headed a chance over the bar but atoned for that a minute later when he beat Connor O'Riordan to the ball and made it 3-2. A topsy-turvy game then continued as Harry Clifton fired home Rovers' third.
Both sides went in search of a winner and just as it looked as though spoils would be shared Joel Bagan popped up and fired home a winner to kill Rovers' hearts.

1. Thimothe Lo-Tutala 3
Shaky in possession. Probably should have done much better with the second Cardiff goal which looked a soft strike from Ashford. A decent save to repel Kellyman at 3-2 but a shocking error for the heartbreaking fourth when he pushed it out and laid it on a plate for Bagan to smash home. So costly. Photo: Howard Roe/AHPIX LTD

2. Sean Grehan 5
Got done all ends up by Davies for Cardiff's equaliser, as Davies beat him before teeing up Kellyman. Did weigh in with clearances, though. Switched to centre-half in a back four once O'Riordan went off and was more solid. Photo: Howard Roe/AHPIX LTD

3. Connor O'Riordan 4
One of many at fault for the second and then got outmuscled by Salech for the third, just after half-time. Not a day to remember for the loanee, who was hooked just before the hour. Photo: Howard Roe/AHPIX LTD

4. Jay McGrath 5
Some good moments early on but was ran ragged by Cardiff's forwards at times. Lucky to avoid going in the book for one or two tackles, too. Recovered his composure when needed. Photo: Howard Roe/AHPIX LTD

