For a while, it seemed like Jordan McGhee and Antonio Portales’ goals would give Dundee their first win at Ibrox since 2001.
The defenders netted within two first-half minutes to give the Dee a shock lead at Ibrox.
But goals from Ross McCausland, Cyrriel Dessers, Todd Cantwell and a double from substitute Scott Wright turned the game on its head.
It means Dundee have now dropped 25 points from winning positions this season.
Tony Docherty made one change from the defeat at Tynecastle, as Aaron Donnelly dropped out in favour of Scott Tiffoney, in a move to a back four and the same shape as the 0-0 draw between the sides last month.
Dundee lead at half-time
Rangers failed to trouble the Dundee goal enough to justify their first-half possession.
Jon McCracken was forced into a comfortable stop minutes in from Ridvan Yilmaz but didn’t make another save until 33 minutes in when Luke McCowan surrendered possession easily and allowed McCausland to test the Dee keeper.
Between those chances, Fabio Silva manufactured a sight at goal but his strike hit the top of the bar on its way over.
In the early stages, Dundee put together some wonderful passages of play when in possession but lacked an end product.
But they stuck to their approach to pass the ball up the pitch and were rewarded with a quick-fire double on 38 and 40 minutes.
Owen Dodgson was the source of both when two of his crosses from the left caught out Rangers.
The first was finished at the back post by McGhee on 38 minutes, his fifth of the season, before fellow defender Portales executed a cheeky flick to make it 2-0.
The second was particularly damning on Rangers, who fell asleep as a free-kick was taken quickly to Dodgson.
Half the stadium thought Mo Sylla had added a third from another set-piece but the ball trickled wide before Rangers got back into the game through McCausland who finished on the angle.
Rangers keep slim title hopes alive
It wasn’t long until Rangers were level through Dessers who headed in his 23rd goal of the season following a Cantwell cross seven minutes after the restart.
Cantwell then tried his luck from outside the box but it was a comfortable stop for McCracken.
At the other end, McCowan pulled a save out of Jack Butland from a similar position after exchanging passes with Amadou Bakayoko.
On 66 minutes, Rangers were afforded a stroke of luck when Cantwell’s mishit cross sailed over McCracken and into the far top corner.
The keeper then made an excellent stop from another powerful Dessers header to keep the score at 3-2.
Docherty sent on Dara Costelloe, Curtis Main and Finn Robertson in a triple change in search of an equaliser but they struggled to break down a makeshift Rangers defence after Clement made five changes of his own.
One of those, Wright, put the game beyond doubt when he fired home at the back post with three minutes remaining before adding another in injury time.
Star man: Amadou Bakayoko
The Dee No 9 played the lone striker role expertly, dropping deep and wide to either take the ball in and find a man or else rough up an opposition defender.
His link play was key to how Dundee progressed up the pitch to cause Rangers problems.
Bakayoko made way for the fresh legs of Curtis Main late in the game after running himself into the ground.
Line-ups
Dundee FC (4-1-4-1): McCracken 6; McGhee 7, Astley 6, Portales 6, Dodgson 7; Sylla 7 (Robertson 74′); Cameron 7, Boateng 7 (Mellon 86′), McCowan 6, Tiffoney 6 (Costelloe 74′); Bakayoko 7 (Main 74′).
Subs not used: Sharp, Mulligan, Robinson, Howley, Donnelly.
Rangers (4-2-3-1): Butland; Tavernier, King (McKinnon 75′), Davies, Yilmaz (Fraser 61′); Raskin, Diomande (Dowell 82′); McCausland, Cantwell, Silva (Roofe 82′); Dessers (Wright 82′).
Subs not used: McCrorie, Barasic, Yfeko, Lowry.
Referee: Matthew MacDermid
Attendance: 45,760
Conversation