With Brisbane Roar safe in first spot ahead of the play-offs, it remains to be seen who will take second and qualify for the Asian Champions League.
The Mariners took a big step towards it being them, though, leapfrogging the Wanderers in front of just over 13,000 fans.
Full-back Joshua Rose put them one up in the 32nd minute after a strong run from his own half, before Nikolai Topor-Stanley turned in a 40th-minute equaliser after Tomi Juric's shot fell to him.
It appeared as though the game would end as a draw after that but, with seconds left, Bernie Ibini-Isei curled in a winner that prompted a firework display from the home club who knew the significance of the goal.
They head to bottom side Perth Glory next weekend.
Saturday's other game saw Melbourne Victory draw 1-1 with Sydney FC.
Joel Chianese put Sydney ahead three minutes after the break but James Troisi equalised midway through the second half.