It wasn't pretty and it wasn't stylish but Ryan Conroy's 83rd minute winner prompted the biggest roar we've heard at Dens Park all season.
Dundee deservedly notched up their first home win after five frustrating and disappointing matches.
Dundee dominated a toothless Rovers side but struggled to break down the visitors' defence and the match seemed to be drifting to a goalless draw until Conroy scrambled home Riley's cross.
Sadly for Calum Elliot his debut for the Dee ended in sickening disappointment when he was stretchered off after being injured only 30 seconds into the match.
Loan signing Elliot was the only change from last week's starting line-up. He replaced Steven Milne and Jake Hyde returned from injury to take a place on the bench, though he barely had time to sit down before he was getting ready to come on.
Sadly for Elliot his debut couldn't have been shorter. Dyer caught him as he turned and he remained lying on the ground clutching his knee, with Dark Blue supporters fearing the worst.
Sure enough that was the end of the Hearts' player's game. He tried to keep going but it was immediately clear that he couldn't run. Indeed Elliot had to be taken to the dressing room on a stretcher as Jake Hyde came on to replace him.
As if that wasn't bad enough Rhys Weston hurt himself attacking a Dee corner. He never looked comfortable after that and was soon replaced by Craig McKeown.
Rovers had their own problems and after half an hour lost centre back Laurie Ellis; the third player to hirple off with hardly a heavy tackle made.
Apart from the injuries there was little to grab the attention in a quiet first half. As ever, Nicky Riley was an inventive threat on the right, but the Dee couldn't create clear chances in spite of some good pressure. The final ball was never good enough and the Rovers' central defenders had few problems.
Raith offered even less threat to Douglas's goal and the only source of excitement for the fans was the usual referee baiting.
Dundee perked up after half time, without looking truly convincing. Gary Irvine sneaked in at the far post to turn in Craig McKeown's flick from a free kick, but an offside flag cut the celebrations short.
The longer the game went on the more cautious Rovers became as they focussed on securing the draw. The visitors failed to get men forward to support their strikers and Dundee were able to break up their attacks without much trouble and keep the pressure on Raith.
The Dee tried to play a passing game, but it seldom worked smoothly and they had difficulty creating chances.
They should have done better with the two that did come their way. Riley intercepted a dreadful pass from Williamson, raced into the penalty area and shot across the face of goal when he could have rolled the ball across for the onrushing McIntosh.
McIntosh then sent Hyde clear. He rounded the keeper but shot high from a tight angle when he should have cut the ball back for McIntosh.
Rovers may not have been looking dangerous, but the best chance of the game came their way after 73 minutes. The ball broke kindly for Williamson, leaving him a clear shot from 15 yards. Douglas blocked with his feet and the ball bounced off Irvine and into the arms of the relieved keeper.
Jamie McCluskey came on for the last 20 minutes, replacing Jake Hyde who seemed to have picked up an injury. The substitute provided just the spark that Dundee needed, playing just behind McIntosh and unsettling Rovers with his determination to attack and to shun the safe option.
Now Dundee had both Riley and McIntosh aggressively running at the Rovers' defence who were looking far less comfortable now.
At last, after 82 minutes, the goal arrived. Riley knocked a long cross from deep on the right to the far post. Ryan CONROY sneaked in from the left unmarked but headed against a defender from close range. The loose ball fell at his feet, and he poked it through keeper McGurn's legs from only a few feet out.
Raith came out of their shell, desperately chasing an equaliser, but the Dundee defence coped comfortably with all their efforts. Indeed, Dundee looked far more likely to get a second goal than to lose one.
Nicky Riley had a great run down the left, and cut into the penalty area but his fierce goal-bound shot deflected off a defender.
In injury time Gavin Rae released Conroy on the left. McGurn saved and O'Donnell's follow up was blocked.
The roar and applause at the final whistle was more relief than elation. At last Dundee have got a victory at home!
They've played better and lost during this poor spell, but today they didn't brood on their misfortunes. They kept their composure and concentration even when the ball wasn't running for them and deserved their win in the end.
Apart from Williamson's chance the defence always looked in charge and thoroughly deserved their first clean sheet at home.
Let's hope that the Dark Blues can build on this now, and start to give the supporters something to really cheer. For much of the second half it looked like it wouldn't be Dundee's day. The supporters didn't get on the backs of the players, who gave the patient fans their reward in the end.
How good it felt to be leaving Dens Park again knowing that three points were in the bag!
Dundee FC 4-4-2
Irvine, McGregor, Weston (McKeown 21), Lockwood
Riley, Rae, O'Donnell, Conroy
McIntosh, Elliot (Hyde 3, McCluskey 72)
Unused subs; Gibson, Chisholm
Goal; Conroy 83
Raith Rovers FC 4-4-2
Donaldson, Ellis (Prychynenko 30), Hill, Dyer
Williamson (87 Reynolds), Murray, Walker, Hamill
Unused subs; Roy (gk), Thomson, Callachan
Booked; Dyer (foul on Riley), Graham (blocking free kick), Prychynenko (foul on O'Donnell)
Referee; Calum Murray
Report; James Christie