Ten-man Motherwell earned a brilliant win at Dens Park to secure their Scottish Premiership status for next season as Dundee manager Tony Docherty was left claiming that officials "contrived" to disallow a "brilliant" goal.
Motherwell had John Koutrombis sent off on 80 minutes, but second-half goals from Tom Sparrow and Tawanda Maswanhise gave them victory and took them 10 points clear of second bottom with three games to go.
Dundee led at half-time after a wonder strike from Mexican midfielder Antonio Portales, who then had a similar hit ruled out for offside later in the first half with team-mate Clark Robertson ruled offside in the build-up.
"I'm not abdicating responsibility as Dundee manager for losing the game," Docherty said. "But we're in a situation now where we've got officials that are finding a way to disallow goals.
"There's no doubt the opposition gets a lift from that decision. We should be going in at 2-0. The officials contrive to find a way to disallow that goal. I just think it's a disgrace to have made that decision."
Defeat means Dundee are not safe of relegation trouble, with Docherty's side two points above the relegation play-off place and eight above bottom.
The hosts started full of intent and kept busy returning Motherwell goalkeeper Aston Oxborough, who kept out Oluwaseun Adewumi then the rebound from Ziyad Larkeche.
Oxborough was at it again to deny Dundee captain Joe Shaughnessy, while Callum Slattery unleashed a cracker that came close to giving the visitors the lead.
Portales showed the way to goal in spectacular fashion. From a long throw-in, the defender controlled and bent the ball into the top corner.
The Dundee fans were still waxing lyrical over the hit when the Mexican was at it again. It was almost an exact carbon copy, the only difference was he finished with his left foot this time.
Unfortunately for him and Dundee, his wonder strike was ruled out for offside after a VAR check.
Koutrombis lifted over before half-time and the visitors started the second half well. Lennon Miller danced into the area and the ball fell kindly to Sparrow, who finished off well.
That goal set up quite the finish at Dens Park. Home midfielder Josh Mulligan raced forward, was in a good position in plenty of space, but his shot was way over.
Well were then depleted. Right-back Koutroumbis was initially shown a yellow for his lunge on Ziyad Larkeche and, after another VAR intervention, it was upgraded to a red.
While many might have fancied Dundee to stretch the 10 men, the visitors were not overly effected. Substitute Maswanhise forced Trevor Carson into a smart save, Dan Casey smashed an effort off the woodwork and Tony Watt shot wide.
And they got the winner when Maswanhise met a lovely ball and nodded it past Carson.
Casey could have added another just before full-time but somehow shot wide.