Swallows were 1-0 up in as early as the seventh minute when Mashego received a pass from Lerato Chabangu and turned inside the box to beat Posnett Omony with a low shot.
Mashego thought he had got his brace in the 20th minute but his strike was ruled out for offside.
Swallows led 1-0 at half-time, but Leopards came back strongly in the second half and they needed only two minutes to make a comeback.
In the 62 minute former Kaizer Chiefs man Michael Nkambule accepted Ramagalela's pass to level the score, and two minutes later captain Mongezi Bobe scored with a powerful free-kick to put Lidoda Duvha in the lead.
The introduction of David Mathebula and Joseph Makhanya changed the complexion of the game, so it came as no surprise when Mashego grabbed his brace with a powerful volley in the final minute, to put the Birds level.