Ben Wilmot wrote his name into South Wales derby folklore as he marked his first league start for Swansea City by scoring the winner at a jubilant Liberty Stadium.
The on-loan centre-half – playing with Joe Rodon out injured – timed his run perfectly to glance home Wayne Routledge’s cross in the 24th minute.
In truth the margin of victory could – and perhaps should – have been far greater, as Swansea spurned a number of chances to put the game to bed.
But no-one seemed to mind too much when the final whistle went to spark the celebrations.
It was the Swans first win in five attempts at the Liberty as Steve Cooper marked his first derby day with three points.
The result means the Swans have secured back-to-back league victories over their rivals for the first time in 23 years.
Cooper had made six changes from the midweek defeat to Brentford as Wilmot, Routledge, Kyle Naughton, Nathan Dyer, George Byers and Bersant Celina came into the side.
Amidst a fantastic, fervoured atmosphere, there was a predictably fast and frenetic start.
Freddie Woodman made the first save of the afternoon, as Cardiff captain Sean Morrison swung his left foot at a ball that dropped to him in the area.
Swansea responded, Dyer working room for Ayew, who was leading the Swansea line, with the forward’s threatening pull-back scrambled clear.
There was a moment of panic for Cardiff keeper Neil Etheridge as his poor clearance allowed Celina to shoot from distance, but the Kosovo international’s effort was always heading off target.
Matt Grimes then fizzed an effort over the bar as a breathless first 20 minutes drew to a close.
Four minutes later and the Swans led, a clever short corner routine allowed Routledge to clip the ball into the box and Wilmot arrived to calmly steer a header into the net.
Dyer made an important challenge in the box as Danny Ward prepared to pull the trigger just inside the area.
Morrison made a block to deny Ayew after lovely work from Celina down the right flank, before the Ghanaian headed the resulting corner over the angle of post and bar.
A couple of uncertain moments from Etheridge allowed Swansea to build further pressure.
Routledge slipped when Cardiff failed to deal with Ayew’s teasing cross with the goal beckoning as the first half entered its final 10 minutes.
The last chance off the half went Swansea’s way, Byers’ header from a Routledge cross beating Etheridge but coming back off the bar.
Grimes worked Etheridge shortly after the break, while an inadvertent handball and the Cardiff keeper combined to prevent Ayew doubling Swansea’s lead.
Celina then fired straight at the keeper from a Jake Bidwell cross as Swansea began to find their stride again.
Joe Bennett recovered superbly as Celina slalomed into the box from a lovely Routledge pass.
Woodman had very little to do, but he just about managed to palm away a Morrison header from a threatening Joe Ralls free-kick.
Seconds later and Gavin Whyte should have levelled. Ralls produced a lovely cross but the winger’s firm effort was superbly held by Woodman.
Swansea hit back, Dyer denied by a Bennett block and a near-post save from Etheridge after another wonderful piece of skill from the irrepressible Routledge.
Inside the final 10 minutes and substitute Sam Surridge led a break-out that ended with Celina firing tamely at Etheridge.
Ayew and Celina wasted golden chances in stoppage time, but it did not matter in the final analysis as the Swans claimed the derby bragging rights.
Swansea City: Freddie Woodman; Kyle Naughton, Mike van der Hoorn, Ben Wilmot, Jake Bidwell; George Byers, Matt Grimes (captain); Nathan Dyer (Sam Surridge 73), Bersant Celina, Wayne Routledge; Andre Ayew.
Subs: Kristoffer Nordfeldt, Connor Roberts, Ben Cabango, Jay Fulton, Kristoffer Peterson, Borja Baston.
Cardiff City: Neil Etheridge, Lee Peltier, Sean Morrison (captain), Aden Flint, Joe Bennett; Gavin Whyte (Josh Murphy 80) Joe Ralls, Marlon Pack, Nathaniel Mendez-Laing (Callum Paterson 81); Danny Ward, Robert Glatzel (Omar Bogle 63).
Subs: Alex Smithies, Will Vaulks, Leandro Bacuna, Curtis Nelson.
Referee: Robert Jones
Attendance: 20,270