With one minute, three seconds left in the match, St Kilda trailed Melbourne by six points with a boundary throw-in on centre wing.
It had been a valiant comeback by the Saints, who were down by 46 points at three quarter time, but look destined to fall just short, with a draw their only hope of salvaging a result.
Saints ruckman Rowan Marshall won the hit-out down to Marcus Windhager, who dished the handball to a running Mason Wood.
Wood's kick inside 50 was spectacularly marked by Nasiah Wanganeen-Milera, who used Bailey Fritsch as a stepladder to snare the ball in front of Judd McVee.
MORE: Death threat made at Melbourne coach after record loss to St Kilda
By the time Wanganeen-Milera kicked the goal to tie the scores at 90-apiece, only eight seconds remained on the clock - making it difficult for either team to get the go-ahead score to win the game.
But in extraordinary circumstances, Melbourne gave away a free kick for breaching the 6-6-6 rule, which saw St Kilda awarded the ball in the centre circle.
In the confusion, which saw the both teams needing to reset their players in position for the free kick, Wanganeen-Milera hatched a plan with Marshall and Marcus Windhager to win the game that would go down in folklore.
As players were madly scrambling to get back into positions, Wanganeen-Milera yelled toward the Saints forward line, demanding the players move out to the right.
The St Kilda superstar was then seen in conference with Marshall and Windhager seconds before the free kick was to be taken.
Once Marshall was given the go-ahead to restart play, Wanganeen-Milera dashed forward into the space in the left side of the 50m arc and Marshall weighted a pin-point kick that was marked by the gun Saint.
With Wanganeen-Milera marking the ball well in his kicking range, all he needed was a score to win the game, but drilled it right through the middle for a goal to cue wild celebratory scenes.
Windhager revealed the part he had in the stunning play during an interview with the Herald Sun after the match.
"For play to proceed, the umpires were saying everyone needed to get back to their starting positions, I just came back to Rowan and I’m like, ‘f**k it, why don’t you just try and get a mark around the 50, and Nas just bolted for it and it was done to perfection," Windhager said.
For St Kilda, the win broke a run of six consecutive losses, while Melbourne's disappointing season continued with their win-loss record slipping to 6-13 - which is the same as the Saints.