Bryan McMahon saved Meath's blushes with a late goal to turn a potential disaster into a battling Leinster SFC win for the hosts in Navan.
The Royal County were hot favourites to sail through to the quarter-finals and a May 25 showdown with Carlow after gaining promotion to Division 1 during spring.
Offaly, in turn, narrowly avoided relegation to Division 4 of the Allianz league but made light of their early season difficulties to push Meath all the way.
John Maughan's side surprisingly led by four points with 15 minutes remaining but were ultimately suckered by a 1-4 scoring burst from Meath.
McMahon scored 1-1 of that blitz with his 63rd-minute goal lifting the 2010 champions from a point behind to two points ahead.
McMahon finished with 1-2 in total while Mickey Newman, back in Championship action after taking 2018 out to recover from various injuries, scored 0-4.
Offaly will rue their 14 wides in total and will return to the qualifiers in early June though will take plenty of heart from running the Royals so close.
Offaly were bidding for a first away win in the Leinster championship since 1997 and indicated early on that they might have some success.
With Niall McNamee back involved in Championship football for the first time since 2017, and converting two early frees, they led 0-4 to 0-2.
McNamee had an exciting duel with Meath full-back Conor McGill while Shane Gallagher tracked Bernard Allen, Offaly's leading scorer in the league.
Peter Cunningham impressed at midfield for Offaly and his second point of the game tied things up at 0-5 apiece approaching the half hour.
McNamee put Offaly ahead briefly before Meath upped the ante with four points in a row.
Captain Bryan Menton, Thomas O'Reilly, Cillian O'Sullivan and Newman were all on the mark as the hosts led 0-9 to 0-6 at half-time.
But it was far from a classic contest with Meath, the strong favourites, looking tentative and nervy as Offaly sought to capitalise on their underdogs tag.
Offaly 'keeper Paddy Dunican was one of three Faithful debutants and blasted two frees wide in the first half.
The Division 3 outfit, who narrowly avoided relegation, hit seven first-half wides in total.
They enjoyed a period of dominance in the third quarter when they reeled off seven points in a row to stun the hosts.
McNamee scored three of those points while Shane Horan, a Dublin based debutant having completed a move to the midlands setup last winter, also got in on the scoring action.
Offaly led 0-13 to 0-9 with 55 minutes played but after putting themselves in a winning position were unable to capitalise.
That 1-4 tally from Meath between the 56th and 72nd minutes, and McMahon's goal, in particular, allowed them to breathe out and look to the quarter-finals.
Scorers for Meath: B McMahon 1-2, M Newman 0-4 (0-3f), C O'Sullivan and B Menton 0-2 each, B Brennan, T O'Reilly and J Conlon 0-1 each.
Scorers for Offaly: N McNamee 0-6 (0-4f), P Cunningham, E Carroll and B Allen (0-1f) 0-2 each, S Horan and N Darby 0-1 each.
Meath: A Colgan; S Lavin, C McGill, S Gallagher; J McEntee, D Keogan, G McCoy; B Menton, S McEntee; C O'Sullivan, B McMahon, B Brennan; B Dardis, M Newman, T O'Reilly.
Subs: A Flanagan for S McEntee (h/t), J Conlon for Dardis (42), G Reilly for O'Reilly (50), S Tobin for Brennan (52), E Lynch for J McEntee (54), P Harnan for Newman (75).
Offaly: P Dunican; D Hogan, E Rigney, D Dempsey; C Donohoe, J Moloney, N Darby; E Carroll, P Cunningham; S Horan, A Sullivan, C Mangan; B Allen, N McNamee, R McNamee.
Subs: S Tierney for Sullivan (55), J O'Connor for Horan (59), P McConway for Carroll (65), M Abbott for R McNamee (66), C Carroll for Cunningham (72).
Ref: M McNally (Monaghan).
Dalo's Hurling Podcast: Bubbles baffles Cork, Clare conquer Walsh Park, Dubs rattle the cage