Three goals nine minute second-half minutes helped Inverness CT to an emphatic win that ensures a seventh place Premiership finish.
Miles Storey broke the deadlock when he escaped the offside trap and rounded Scott Bain before netting.
Danny Devine tapped home at the back post from a corner before Ross Draper capitalised on Julen Etxabeguren's error to fire home.
Richie Foran added a late penalty after Liam Polworth was tripped.
Dundee knew before kick-off that they needed a win to leapfrog their hosts and finish top of the bottom half of the table.
Both sides named unchanged line ups, with Danny Williams making his last appearance for the home side before joining Dundee this summer, alongside team-mate James Vincent.
Dundee's Paul McGinn is out of contract this summer and looks likely to depart with a number of sides apparently keen on recruiting him.
If possession won football matches the home side would have been out of sight in the opening quarter.
Iain Vigurs wasted a great chance with a tame free kick from the edge of the box and two long range Greg Tansey strikes landed safely in Bain's arms.
Dundee initially struggled to get on the ball but came closest to an opener on the counter when Greg Stewart combined with Kane Hemmings then curled a great effort from outside the box which unluckily clipped the bar.
Rory Loy fired wide, Hemmings fired over with a clear sight of goal and McGinn watched Owain Fon Williams parry his effort clear as the visitors threatened.
Inverness again took control in the second period with Williams seeing a close-range shot blocked, with another long range effort from Tansey shot held easily.
The match needed a moment of inspiration. It arrived when Storey timed his run well to go clear. Despite being forced wide by goalkeeper Bain the striker found the angle to net his 13th of the season.
It all fell apart for Dundee. Devine tapped home at the back-post after a corner was flicked on before Etxabeguren inexplicably lost possession on the edge of his own area and Ross Draper fired past the exposed Bain.
It got worse after the home side introduced two popular substitutes. The departing David Raven had a rare outing and Foran came on and scored a convincing penalty after Polworth was tripped by Adam Black.
Dundee were denied a late consolation when Craig Wighton's poke toward goal was superbly saved by Fon Williams.
This was a fifth win in seven games for John Hughes' side, who might wish this was the start of the campaign rather than the end. It was a horrible end for Dundee, who are a better side than this defeat suggests.