Thank heavens for Fernando Torres. Chelsea were staring at FA Cup humiliation at the hands of League One opposition and Rafael Benítez was feeling the fury of the club's travelling support when the striker, who has become synonymous with a failure to deliver when it really matters, cast off the shackles.

Torres's late equaliser was marked by the kind of quality that persuaded Chelsea to break the British transfer record to sign him and, although it is trite to suggest that it repaid a slice of the £50m fee, there could be no doubting the relief that it brought.

Benítez was prominent among the beneficiaries. His 78th-minute substitution of Branislav Ivanovic for César Azpilicueta, one right-back for another, as Chelsea trailed to Harry Forrester's penalty, drew derision from the away enclosure, who told him that he did not know what he was doing. There was the stock reminder that he was not wanted by them, and the end of the first half had triggered an outpouring of abuse.

Torres's instinctive finish – right-footed into the far corner – painted happier headlines for Chelsea, who had to fear the worst after Ballboy-gate at Swansea City last Wednesday. They could even have snatched it in injury time when the substitute Juan Mata's cross struck Harlee Dean's hand only for the referee, John Moss, to ignore the penalty appeal.

Perhaps, he subconsciously gave in to his romantic side because defeat would have been awfully harsh on Brentford, who controlled the first half and contributed heavily to an engrossing tie. The intensity of their midfield trio was stirring and Shaleum Logan and Forrester caught the eye with their enterprise on the left flank. The cheers from the home crowd upon the final whistle spoke of a famous result and Kool and the Gang's Celebration caught the mood, as it was played over the PA system.

Benítez had taken few chances with a strong lineup, in which all six of his senior English players started, although he would tell you that his squad is so stretched at present he has little room for manoeuvre. But Chelsea were dismal in the first half, creating nothing of note and struggling to piece together passes. Brentford looked as if they wanted it more, in front of their biggest home crowd in three decades and on a pitch that was the leveller of cup lore.

Believe it or not, Chelsea paid for the surface to be seeded, as part of the deal that allows their under-21s to play here sometimes and they felt it cut up badly. Brentford seek to get the ball down and play but, as Chelsea battled to come to terms with the bobbles, Uwe Rösler's team revelled in their familiarity.

Ross Turnbull epitomised the Chelsea edginess. In for the injured Petr Cech, the goalkeeper had endured an early misunderstanding with John Terry, which resulted in him getting too close to the returning captain and picking up his back-pass. Forrester lifted the free-kick over the crossbar. But when Forrester shot from distance before the interval, after the impressive Adam Forshaw had robbed Frank Lampard, Turnbull could only parry to the feet of Marcello Trotta, who ignited the occasion with his finish.

Benítez responded at half-time by sending on Mata for the anonymous Marko Marin, moving Oscar to the right and, presumably, instructing his team to show a bit of backbone. He had wanted to spare the overused Mata but the situation felt desperate. He got the response that he wanted, with Chelsea coming to show purpose and their first equaliser duly arrived. It was a beauty.

Oscar had looked as though he would rather be elsewhere in the first half; possibly, on a beach in his native Brazil. At least there was plenty of sand on this pitch. But he came alive inside the area, showing his balance to wriggle past defenders before curling home with the outside of his right boot. Mata drew a smart save out of Simon Moore shortly afterwards and it seemed as if Chelsea were primed to weather the storm.

Wrong. Rösler withdrew Trotta for Tom Adeyemi, moved Clayton Donaldson to his normal No9 role and enjoyed a stunning dividend. Donaldson's pass ushered in Adeyemi and when he nicked the ball past Turnbull, he found himself impeded by the advancing Chelsea goalkeeper's challenge. The visitors complained about the lack of contact but Turnbull had been clumsy. He was booked – the sanction could have been worse, on another day – and Forrester kept his nerve from the spot.

Ivanovic had gone close with an overhead kick when Benítez swapped him for the fresh legs and natural width of Azpilicueta, who promptly crossed for Ryan Bertrand to head off target, and it became easy to imagine the reaction to a Chelsea exit. Torres, however, stepped forward to save the day. The club's Cup defence remains alive.