Bryan Gilfillan had levelled for Annan in-between times and the hosts had Aaron Muirhead sent off after he was booked for a second time on 36 minutes.
But Annan claimed a point when Macfarlane slammed home in the closing seconds of the match.
Annan Athletic: Summersgill, Muirhead, Neilson, Aitken, Halsman, Steven Sloan, Gilfillan, MacBeth (Bell 68), Jardine (Macfarlane 69), Harty (Steele 86), O'Connor. Subs Not Used: Jamieson, Felvus.
Sent Off: Muirhead (36). Booked: Muirhead, Gilfillan.
Goals: Gilfillan 6, Macfarlane 90.
Elgin: Donnelly, Dempsie (Edwards 84), Kaczan, Nicolson, Niven, Cameron, O'Donoghue, Jake Inglis, Frizzel, Crooks (Millar 88), Gunn (MacDonald 74). Subs Not Used: John Calder, Barry Wilson.
Goals: Crooks 3, 11.
Ref: G Hilland
Source: BBC Sport