Neil Kilkenny came back to haunt his former side and Adam Taggart scored a 97th-minute winner to lift Perth Glory to a 2-1 win over Melbourne City at nib Stadium.
City whizz-kid Daniel Arzani opened the scoring in the 44th minute on Saturday night with a beautiful curling strike.
But the game turned on its head in the 66th minute when defender Bart Schenkeveld was red-carded for a second bookable offence.
Schenkeveld was given his first yellow card in the 56th minute after vigorously protesting a free-kick handed to Kilkenny.
He was given his marching orders 10 minutes later when his attempted diving tackle on Joseph Mills caught the defender's legs.
Kilkenny starred for Melbourne City last season, but he left the club in acrimonious circumstances last month after a public falling out with coach Warren Joyce.
Glory swooped to sign Kilkenny, and the midfielder proved his value with an 85th-minute goal, drilling low from just inside the box.
The drama got even more intense as the match neared its end.
Taggart missed two golden chances to put his team ahead.
But he made the most of his third chance after Glory were forced to pull off a goal-line clearance.
Perth raced the ball forward, and a perfect cross made its way to Taggart, who headed the ball home to send the crowd of 8029 into raptures.
Just minutes earlier, Joyce was handed a yellow card for venting his frustrations.
The win means Perth are now just four points adrift of sixth spot with six rounds remaining.
City are still in third spot, but face a crunch derby against Melbourne Victory on Friday.
Saturday's first half was a dour affair as both sides struggled to create clear-cut opportunities.
The crowd took part in a moving clapping tribute in the 10th minute to pay their respects to former Glory midfielder Liam Miller, who died of pancreatic cancer earlier this month at the age of 36.
Arzani's class was clear to see, but it took until the stroke of half-time for him to be rewarded for his efforts.
The speedy striker rounded Glory defender Dino Djulbic before unleashing a mesmerising right-foot strike into the top corner of the net.
Taggart, who had been sidelined since January 13, was introduced into the fray in the 58th minute as Glory searched for an equaliser before providing the killer blow in the dying minutes to keep Glory's faint finals hopes alive.
Australian Associated Press