Mayo fought back to spoil Cork's chances of a much-needed league win at Páirc Uí Rinn as the Connacht champions stole in late for a 1-12 to 2-8 victory.
The Rebels, who remain second from bottom in Division 1A, lost their way as Mayo scored 1-3 at the start of the second half and grabbed the match-winning point from Aidan Kilcoyne in injury-time.
Goals from Michael Cussen and Kevin O'Sullivan helped Cork go in at the break with a 2-5 to 0-5 buffer.
But Conor Mortimer netted four minutes into the second period and Mayo hit form to overhaul the hosts with late points from Andy Moran, Marty McNicholas and Kilcoyne.
Conor Mortimer dinked over a first-minute free to get Mayo off the mark but Cork, whose last win was in Round Three against Tyrone, rose to the occasion and quickly fired themselves into a 1-3 to 0-3 lead.
The talismanic James Masters cracked over two frees and then in the eleventh-minute, a high ball in from the Nemo Rangers clubman saw the statuesque Cussen palm home Cork’s opening goal.
The statuesque Glanmire attacker certainly showed off his skills as a target man and Billy Morgan could continue to deploy him as a full-forward in the mould of Kerry's Kieran Donaghy.
Cussen followed points from Kilcoyne and Mortimer by bisecting the posts himself.
Mayo then threw their captain Kevin O'Neill, who has recovered from a hamstring injury, into the fray and they kept in the hunt with David Heaney, starting in his old position of midfield, turning in an energetic performance.
Heaney pointed before Cork raced up the other end and notched their second goal through O'Sullivan, who volleyed first-time past Mayo keeper Kenneth O'Malley after Cussen had knocked the ball into his path.
Mayo were pressurised into some poor shooting and Cork then wasted a chance of a third goal when O'Malley managed to just tip an arcing shot from O'Sullivan over the bar.
O'Neill's right-sided point was cancelled out by Masters' third score of the night to keep Cork six points clear at the interval.
Although manager John O'Mahony would not admit it, Mayo came out a different team for the second half – midfielder Pat Harte swung over an inspirational point, Mortimer added another before he found the net with a drilled 39th-minute shot.
Some neat interplay from O'Neill, Heaney and the supporting Peadar Gardiner, who was on one of his many forays forwards, teed up Mortimer for a memorable strike.
The game was there for the taking as McNicholas landed the levelling point at 1-8 to 2-5. Masters struck back for Cork, Mortimer replied before Masters again shot Morgan’s men into the lead.
The tie ebbed and flowed and Masters perhaps should have gone for goal when the industrious O'Sullivan played him into space but he opted for another point that pushed Cork 2-8 to 1-9 clear.
Cork, however, were held scoreless for the remainder as O'Malley thwarted Kevin McMahon and Mayo hit over three successive points through substitutes Andy Moran, who fisted over, and McNicholas and the pin-point accurate Kilcoyne.
The All-Ireland U-21 winner calmly sent over the match-winning score to move Mayo to the top of the standings alongside unbeaten Donegal.
For Cork, who have lost four of their five league games, their trip to meet bottom side Fermanagh on 1 April has taken on added significance.