After a drab first half, the match burst into life in the second period and either side could have struck before Rooney's penalty 10 minutes from the end cemented the Dons' place in second in the Scottish Premiership.
Former Manchester United and Aston Villa midfielder Djemba-Djemba only joined St Mirren last week and this was his home debut, so giving away the late penalty was a sorry way to mark the occasion.
St Mirren manager Danny Lennon brought Jim Goodwin back into his defence to replace the suspended Marc McAusland, which allowed the returning John McGinn to step into the midfield which was tasked with providing support to Steven Thompson, as on-loan Josh Magennis was unable to face his parent club.
Barry Robson and Jonny Hayes both failed to make the Aberdeen squad as the visitors counted the cost of their Scottish Cup win over Celtic. Manager Derek McInnes brought Joe Shaughnessy and Nicky Low into the starting line-up in their place.
There was a swirling wind around St Mirren Park as the match got under way, and it was Aberdeen who adapted to the conditions the quickest, forcing a series of early corners that Marian Kello struggled to deal with as they were swung in under his crossbar.
Another corner for Aberdeen provided their first shooting opportunity, Niall McGinn finding Shaleum Logan on the edge of the penalty area, from where the defender fired a dipping shot just over.
There was precious little other goalmouth action in the opening 25 minutes, but the home side finally signalled their intent to get in behind the Aberdeen rearguard when Gregg Wylde was released in behind Shaughnessy down the left.
From a promising position, the winger's heavy touch allowed Russell Anderson the opportunity to clear.
The visitors then had a free-kick in a promising position following a barge by Wylde on Logan 20 yards from goal, but McGinn could only fire into the wall.
John McGinn was trying to get his foot on the ball and was at the heart of most of the positive play for the home side, but there was very little to get excited about.
The second half started in a more promising fashion, and St Mirren went agonisingly close to opening the scoring within a couple of minutes of the restart.
Kenny McLean was released down the right wing and the midfielder lifted his head to find Thompson in the centre of the area, the big striker sliding the ball just wide of Jamie Langfield's left-hand post under pressure.
The home fans were incensed moments later as Paul McGowan bore down on goal only to be halted by the assistant referee's flag in what seemed to be a marginal offside call.
The first booking of the match went to St Mirren's Jim Goodwin after 52 minutes, the home skipper adjudged to have handled a ball that seemed to be struck against his arm by Rooney as the striker tried to break beyond the St Mirren defence.
It was Aberdeen's turn to threaten next as an outswinging corner was met forcefully by the head of Andrew Considine just eight yards out. His effort was just too close to Kello however, allowing the Slovakian to make a diving save to his left.
Aberdeen went close again after 65 minutes, Shaughnessy's long throw-in from the right being flicked on at the near post by Considine where the arriving McGinn only just failed to make what would surely have been a goalscoring contact.
St Mirren's combative midfielder Djemba-Djemba was next in the book after 71 minutes, picking up a caution for a crude challenge from behind on McGinn.
The game was again becoming disjointed, and Lennon made his first change of the day with 15 minutes remaining, replacing McGowan with Adam Campbell.
It was Aberdeen who seized the initiative though, and Kello initially did well to deflect Low's stinging effort wide from the edge of the area.
From the resulting corner, Aberdeen grabbed the match-winning goal.
There seemed little danger as the visitors' attempted short-corner routine broke down, but as Peter Pawlett picked up the scraps and drove into the area he was sent flying by a careless tackle by Djemba-Djemba.
Referee Calum Murray pointed straight to the spot, and Rooney stepped up to send Kello the wrong way and net his second league goal for the club.
Djemba-Djemba was replaced by Gary Teale after 83 minutes to round off a miserable afternoon for the Cameroon international, and Aberdeen boss McInnes responded by sending on Alan Tate for Nicky Low a minute later.
Darren McGregor had the ball in the net for St Mirren after 85 minutes, but the defender's celebrations were cut short as the flag went up for offside.
Aberdeen should have scored again the final minute, Rooney breaking clear and shooting straight at Kello before being unable to find the unmarked McGinn from the rebound, but they were able to hold on and take a valuable three points back north in the battle for second place.