Substitute Kevin McLoughlin broke Meath hearts in Navan with a late cameo that yielded 1-2 to seal a dramatic Allianz football league Division 1 win.
Meath, chasing a first win over Division 1 opposition since the 2014 Championship, put themselves in a great position when they fought back from six points down at half-time to lead by one with 68 minutes on the clock.
They had a strong wind behind them in the second half and capitalised on it with goals from James McEntee and Ronan Jones to put themselves in pole position late on.
But McLoughlin, who'd earlier converted a vital free, kicked the equaliser and was then fed by Ryan O'Donoghue to strike a 70th-minute goal that ultimately separated the teams.
It was a huge win in the context of Mayo's season having come into the match with just a point from a possible four but for Meath their third straight defeat leaves them stuck in a relegation battle.
They lost to Tyrone by five points in Round 1 last month and by double that last Sunday when visitors Donegal fought back from a slow start to win at their ease.
It was Mayo that got the bright start this time in Navan though they were aided by the strong, diagonal wind that was blowing in their favour towards the town end.
Tommy Conroy opened the scoring after five minutes and Mayo put five points on the board in total, two of those coming from James Carr, before Meath finally grabbed one themselves through Bryan Menton in the 25th minute.
Meath found it difficult to cope with the crosswind against them and Menton was among those who kicked wides in the opening half. Shane Walsh, starting his first league game of the season following injury, claimed an advanced mark but booted his point attempt wide too.
Menton's point ended up being Meath's only score of the half with Mayo dominating possession and implementing a strong press on the Royal County's kick-outs which goalkeeper Marcus Brennan, already kicking into a stiff wind, struggled to deal with.
Mayo wrapped up the first-half scoring with points from Ryan O'Donoghue and a beauty by Fergal Boland at the end of a patient passing move to lead by 0-7 to 0-1 at half-time.
It all changed in the second-half as Mayo struggled with the wind and booted four wides in a row in the third quarter.
Meath weren't much better initially but when McEntee and Jones netted in the 50th and 54th minutes they suddenly led by a point at 2-2 to 0-7 and had strong momentum.
They led in the 64th minute when Cillian O'Sullivan claimed a mark and converted it but that was as good as it got as McLoughlin took over, finishing with 1-2 and accounting for all of Mayo's scores in the second half.
Mayo scorers: K McLoughlin (1-2, 1 free); J Carr (1 free) and F Boland (0-2 each); T Conroy, P Durcan and R O'Donoghue (0-1 each).
Meath scorers: J McEntee and R Jones (1-0 each), B McMahon (0-2, 1 free), T O'Reilly (1 free), C O'Sullivan (1 mark) and B Menton (0-1 each).
Mayo: R Hennelly; B Harrison, J McCormack, L Keegan; E O'Donoghue, M Plunkett, P Durcan; S Coen, D O'Connor; F Boland, R O'Donoghue, J Durcan; T Conroy, J Carr, A O'Shea.
Subs: K McLoughlin for Carr and C Loftus for Conroy (h/t); E McLoughlin for McCormack (56); C Treacy for Durcan (61); B Walsh for Boland (68).
Meath: M Brennan; R Clarke, C McGill, D Toner; B Conlon, R Ryan, D Keogan; B Menton, R Jones; J McEntee, B McMahon, C O'Sullivan; E Devine, T O'Reilly, S Walsh.
Subs: J Wallace for Walsh (47), E Wallace for Devine (53).
Ref: S Hurson (Tyrone).