Westmeath survived the first half dismissal of Derek McNicholas to edge out neighbours Meath at TEG Cusack Park and pip both the Royals and Kerry on scoring difference for a Leinster SHC quarter-final place against Offaly.
Killian Doyle scored the only goal midway through the second half as Michael Ryan's charges, who had lost their first two games to Laois and Kerry, progressed to the quarter-finals for the third year-in-a-row and condemned a luckless Meath to relegation straight back to the Christy Ring Cup.
This was a huge win for the Lake County who were able to produce the goods when it mattered most, despite having full forward McNicholas red-carded just before half-time following an incident involving Shane Brennan. Meath had reduced their lead to the minimum when Doyle's goal gave them breathing space again. Their progress was confirmed by Laois' victory over Kerry in Tralee.
The accuracy of Allan Devine from placed balls helped the hosts to a 0-9 to 0-6 interval lead, but they looked to have it all to do after being reduced to 14 men and having to face into the breeze in the second half. However, Westmeath continued to hold the whiphand before two Stephen Clynch frees and a brilliant individual point from Daragh Kelly left the minimum between the sides with 20 minutes to go.
But Westmeath pulled clear again in the 51st minute when Doyle fired a low shot to the net after being set up by Aonghus Clarke. The Lake County stretched their advantage to seven points before Martin Ennis' men hit three points in succession and substitute Sean Quigley added two late frees to bring them to within two.
However, the goal the Royals needed never materialised as they were sent back to the second tier for 2018.
Westmeath - P Maloney; S Power, T Doyle, T Gallagher; A Craig, P Greville, C Shaw; A Clarke (0-2), G Greville; D McNicholas (0-1), K Doyle (1-3), C Boyle (0-1); A Devine (0-9, 6f), N Mitchell, R Greville (0-2). Subs: N O'Brien for T Gallagher, J Boyle for N Mitchell, J Galvin for K Doyle, D Egerton for C Shaw.
Meath - S McGann; S Whitty, D Kelly (0-2, 1f), C Reilly; S Brennan, D Healy, K Keoghan (0-2); A Forde, S Geraghty; S Clynch (0-5, 3f), J Keena, K Keena; M O'Sullivan (0-1), N Heffernan, A Gannon (0-4). Subs: J Kelly (0-2) for K Keena, G McGowan (0-1) for N Heffernan, S Quigley (0-2f) for J Keena, C McCabe for M O'Sullivan, P Kelly for S Clynch.
Referee - C Cunning.