Cork produced the stronger finish as late points from substitute Paul Kerrigan and Donncha O’Connor guided them past Mayo in Castlebar, winning 0-14 to 0-13.
The Connacht champions had looked likely winners at the end of the first half, armed with a 0-07 to 0-03 lead and with Cork’s Mark Collins sent-off.
Michael Conroy, substitute Conor Mortimer and Alan Dillon impressed up front for the hosts, but the latter saw red as Cork launched a determined fight back which sealed their third league win.
Credit to Conor Counihan’s men, they showed great tenacity to pull off this result but Mayo manager James Horan and his players will look back on today’s game as one that got away from them.
A degree of panic crept into Mayo's play as they saw a five-point lead whittled away in the closing 19 minutes, with passes going astray and poor shots being taken.
Cork, though never really hitting top gear, managed to come to the fore when it mattered most as they scored eight of the game's final ten points.
The Rebels' build-up play was laboured in the first half and Mayo took advantage with a strong breeze behind them. Alan Freeman kicked them ahead, profiting from Barry Moran's long delivery in which corner-forward Conroy won.
Scores were hard to come by in a tough-tackling first quarter. There was plenty of bite in the challenges and Cork injected some pace up front to see O'Connor and Colm O'Neill (free) point them ahead at 0-02 to 0-01.
An inspirational point from centre-back Donal Vaughan, set up by Freeman, got Mayo level in the 18th minute and they moved ahead again when Keith Higgins, newcomer Shane McHale and Barry Moran combined to tee up an excellent Conroy score from the left.
Dillon made it 0-04 to 0-02 before a free from Paddy Kelly ended a barren spell for Cork who struggled to turn some well-won balls in midfield into scores.
Horan made a couple of changes nearing the half hour as he introduced Peadar Gardiner and Mortimer, and the experienced pair helped the hosts add to their lead.
Points from Conroy and Mortimer were followed by the sending-off of Cork centre-forward Collins who received his marching orders for striking Vaughan in an off-the-ball incident.
Dillon tagged on an injury-time point to give Mayo a four-point buffer to take into the second half.
The margin was out to five when Vaughan and Dillon got on the ball and created space for Andy Moran to notch the home side's eighth of the afternoon.
There was no sign of Cork wilting though as they replied with well-struck points from O'Connor and centre-back Sean Kiely, with the pace of substitute Paul Kerrigan beginning to stretch the Mayo rearguard.
The visitors got quicker ball in to the likes of Kerrigan and O'Connor, but Mortimer increased his influence at the other end with a quick brace. O'Connor and Kevin McLoughlin then traded scores before Cork enjoyed a purple patch.
O'Connor fired over a crisply-hit '45 just moments after Ger Cafferkey blocked his goal-bound shot.
Kerrigan was afforded too much space when he blazed over a monster score to close the gap to three points.
Not to be outdone, Andy Moran landed a skyscraper of his own from out of the right, but the momentum was now with 14-man Cork as points followed from substitute Barry O'Driscoll, Kelly and the hard-working Aidan Walsh.
Substitute Jason Doherty snuck a point in for Horan's charges, however the dismissal of Dillon - he was booked for a second time - had them really struggling to hold onto their slender lead.
O'Connor pointed the resulting free to make it a one-point game, and his partner in crime Kerrigan squared things up with two minutes of injury-time signalled for.
The game's defining moment came when defender Paudie Kissane drove forward and went for a point on the standside. His effort came back off a post and fell for O'Connor who got the better of Higgins to land his sixth score of this topsy-turvy encounter.
Scorers - Mayo: C Mortimer 0-03 (0-01f), A Moran, M Conroy, A Dillon 0-02 each, A Freeman, D Vaughan, K McLoughlin, J Doherty 0-01 each
Cork: D O'Connor 0-06 (0-02f, 0-01 ‘45'), P Kelly (0-01f), P Kerrigan 0-02 each, S Kiely, B O'Driscoll, A Walsh, C O'Neill (0-01f) 0-01 each
Mayo: D Clarke; C Boyle, G Cafferkey, K Higgins; L Keegan, D Vaughan, S McHale; S O'Shea, B Moran; K McLoughlin, C O'Connor, A Dillon; A Freeman, A Moran, M Conroy.
Subs used: P Gardiner for Keegan (27 mins), C Mortimer for O'Connor (29), D Geraghty for O'Shea (42), J Doherty for Conroy (50), A Campbell for Boyle (64).
Cork: A Quirke; R Carey, M Shields, E Cotter; N O'Leary, S Kiely, P Kissane; P O'Neill, A O'Connor; F Goold, M Collins, P Kelly; C O'Neill, A Walsh, D O'Connor.
Subs used: P Kerrigan for C O'Neill (half-time), Barry O'Driscoll for Goold (58 mins).