Didier Drogba climbed off the substitute's bench to send Chelsea into the knockout stages of the Champions League.
The Ivory Coast international, a 65th minute substitute for opening scorer Salomon Kalou, poked the ball under CFR Cluj goalkeeper Nuno Claro for the winner just six minutes later.
It was Drogba's second goal of the season and his first appearance at Stamford Bridge since he collected a three-match domestic ban for throwing a coin into the crowd during their Carling Cup defeat by Burnley.
But Drogba's efforts were not enough for Chelsea to finish top of Group A after Roma defeated Bordeaux.
Chelsea have only themselves to blame for finishing second. They squandered two chances to top the group during a European campaign that has eventually seen them stutter across the first-stage finishing line.
Luiz Felipe Scolari insists he feels 'zero pressure' as coach of Chelsea but his animated behaviour on the touchline in the early moments of the game suggested otherwise.
The Romanians had given Chelsea a grave warning as early as the seventh minute when a 25-yard shot from Alvaro Pereira almost eluded Chelsea goalkeeper Petr Cech.
The Czech Republic international had to dive low to his left to prevent the ball from finding the bottom left-hand corner of the net.
Chelsea were far from convincing although Alex should have done better when he met Deco's 12th minute free-kick at the far post.
The Brazilian timed his jump to perfection but the ball bounced off the ground and high over crossbar.
But the visitors clearly had the scent of blood in their nostrils and when Hugo Alcantara met a cross from Juan Culio at the far post, it required an alert John Mikel Obi to clear the danger from within his own six-yard box.
Chelsea, once again flattering to deceive, picked up the pace of the game and in the 25th minute Joe Cole, one of their better performers, sent a 20-yard shot beyond an upright.
The breakthrough for Scolari's side finally arrived five minutes before the interval and was supposed to calm the jangling nerves.
Cluj paid a heavy price for Eugen Trica's foul on Michael Ballack.
Firstly, Trica collected a yellow card for his misdemeanour but worse was to follow when Deco finally floated the free-kick into a crowded Cluj penalty area.
The visitors were clearly hoping to nullify the threat of John Terry by pushing him to the ground but in doing so they inadvertently allowed the ball to run through to the unmarked Kalou.
The Ivory Coast striker quickly seized his chance and sent the ball high into the net from close range for his fourth of the season.
Chelsea's home form had been less than spectacular in recent weeks with two defeat and a draw in their last three games at Stamford Bridge.
Kalou's goal should have been the springboard for Chelsea to go on and finish Cluj off, but just as they had with Burnley and Arsenal, Scolari's side allowed their opponents to get back in the game.
In the 55th minute, Culio's backheel to Cristian Panin on the right flank left Chelsea flatfooted.
But worse was to follow as Panin's cross to the far post eluded Alex and Yssouf Kone headed beyond Cech into the top corner.
Moments later Joe Cole wasted a gilt-edged chance to put the home side back in front but his shot from the edge of the penalty area was superbly saved by Claro.
Scolari had seen enough and replaced Kalou with Drogba in the 65th minute.
It was his wisest decision of the night as six minutes later the Ivorian had put Chelsea back in front and calmed their nerves.
Mikel burst out of defence and played a simple ball to Joe Cole. The England midfielder, realising Drogba had timed his run into the penalty area, showed exquisite vision by lifting the ball over the Cluj defenders.
Drogba still had it all to do as the ball fell at his feet, but with the Cluj defence converging on him, he quickly sent his shot under Claro for the winner.
Chelsea should have increased their lead after that but failed to make the most of their possession.
Claro saved well to deny Ballack but it was their only real effort.
Instead, the English side settled for second place in the group with a stuttering performance that possessed little of the swagger which took them to the final last season.Reuse content