Jake Melksham has nailed a set shot with 30 seconds remaining to steal a one-point win for Melbourne and continue the Brisbane Lions' miserable MCG record.
Down by 25 points early in the final quarter, the Demons stormed home with the final four goals of the match in an extraordinary late surge.
Melksham marked about 40m out on a slight angle with a minute to go, calmly going back and popping his shot over the line.
Brisbane cleared it into their forward-50 in the dying seconds as Eric Hipwood tried to claim a mark 50m out, but the umpires decided Jake Lever had some of the ball and the game ended.
Melbourne prevailed 16.9 (105) to 16.8 (104) to be just a game behind the third-placed Lions in a crucial result for both teams' premiership prospects.
Coming into Friday night's match with 12 straight regular-season losses at the grand final venue dating back to 2015, the shell-shocked Lions conceded the first four goals of the game in the opening five minutes.
After surviving the early carnage, led by red-hot Demons star Christian Petracca, the Lions settled to dominate the second and third terms by booting 12.4 to 6.2.
Leading by 22 points at the final change, Brisbane looked to be home, but the Demons made an unlikely late run as the Lions' midfield dominance stopped.
Chris Fagan has constantly bristled at questions why his team struggles at the Melbourne colosseum, but the Lions have won there just once in their past 15 visits.
The Demons racked up their biggest score in nine weeks as their under-fire forward line functioned better.
Petracca starred with his second four-goal haul in as many weeks, creating problems for the Lions' defence in a more unpredictable Demons forward-half.
Melbourne defender Harrison Petty was eventually substituted out in the third quarter after struggling with a back injury, replaced by Joel Smith.
The Demons went in with captain Max Gawn as their main ruckman after opting to axe star recruit Brodie Grundy as the Demons hope he can hone his forward craft in the VFL.
Star Lions forward Joe Daniher had a dominant night with a team-high 24 possessions and was influential up forward and in the ruck.
Lions veteran Jack Gunston overcame a slow start to kick three majors, backing up a six-goal haul last week against West Coast in an impressive return after spending four weeks in a "training block".
Melbourne host Adelaide at the MCG next Sunday, while the Lions are back at the Gabba to face reigning premiers Geelong.