Substitute Mohau Mokate scored a last-gasp winner moments after Ndumiso Mabena cancelled out Deolin Mekoa's first-half opener for United at Royal Bafokeng Stadium.
The result sees the Team of Choice climb above University of Pretoria and SuperSport United into eighth spot on the table with 30 points from 23 games - six points more than 13th-placed Dikwena.
Steve Komphela's side ended a nine-game winless run in all competitions in midweek with a 1-0 victory over log leaders Kaizer Chiefs.
Maritzburg dominated the first half, nearly scoring in the 11th minute as Ryan de Jong's fierce drive was tipped over the crossbar by goalkeeper Kabelo Dambe.
Dambe made another save to deny a header from Man of the Match Kurt Lentjies before United deservedly claimed the lead through Mekoa in the 28th minute. Mekoa received a pass from Mohammed Anas just inside the penalty area and took advantage of the space given to him by Stars’ defenders to turn and fire home a left-footed shot for his first topflight goal.
The match seemed destined to end 1-0 in favour of United, but two late goals ensured a dramatic finish to the encounter.
First, Mabena broke a scoring drought in the League that stretched back to early December when he got ahead of his marker to turn home a cross in the 87th minute to make it 1-1.
However, Maritzburg reclaimed the lead in the final minute of regulation time through Mokate, who fired home from close range after brilliant set-up play by Lentjies. The midfielder fought his way to the right by-line before pulling back a perfect pass that put the goal on a plate for his teammate.