Jeff Goulding came off the bench to secure a last-gasp win over Oxford and keep Aldershot's survival hopes alive.
The Shots had been in control through Paul McCallum's early strike and Craig Reid's penalty just after half-time.
But a Scott Davis free-kick reduced the arrears and Jon-Paul Pitmann levelled things five minutes from time despite a red card for Michael Raynes.
However, substitute Goulding headed in Danny Rose's free-kick two minutes later to secure a first win in seven.
The Hampshire side are now two points from safety and have a game in hand on six of the seven sides directly above them.
VIEW FROM THE DRESSING ROOM
Aldershot Town manager Andy Scott told BBC Surrey:
"We made it hard for ourselves but the way we responded was tremendous.
"I think we deserved to win the game and it's the first time we've scored three times since I've been here.
"The set-piece from Adam Mekki was a fantastic delivery and Jeff (Goulding) has got on the end of it and we deserved to win the game and it keeps us in the hunt.
"The crowd played a big part today because going 2-0 up and then 2-2, there could have been nerves and they responded and we had to for them."
Aldershot 01 Warner 02 Herd 03 Tonkin 04 Morris (Mekki - 18' ) 11 Vincenti 19 Forbes 23 Bradley 24 Hall 31 Rose 15 McCallum (Goulding - 64' ) 20 Reid Booked (Roberts - 89' ) Substitutes 29 Morris 06 Lancashire 12 Risser 17 Mekki 28 Cadogan 33 Roberts 26 Goulding Oxford United 24 McCormick 02 Batt 04 Raynes Dismissed after an earlier booking 06 Wright 16 Whing 08 Heslop (Constable - 46' ) 14 Rigg (O'Brien - 9' ) 26 Davis 27 Davies 15 Potter 29 Craddock Substitutes 31 Crocombe 22 Worley 23 O'Brien (Pittman - 62' ) 35 O'Dowda 25 Parker 09 Constable 11 Pittman