In an entertaining encounter, which saw both sides go close, a draw looked likely and deserved for Roberto Martinez's side as Chelsea looked set to drop points at Stamford Bridge for only the third time this season.
However, two minutes into added time Frank Lampard's free-kick was deflected into his own net by Tim Howard after captain Terry got a slight touch.
Everton had gone close themselves, with Petr Cech saving well from Leon Osman in the first half, and then the Czech was at full stretch to deny the England midfielder on the hour.
Chelsea were also not without their chances and Howard pulled of a fine double save, firstly from Eden Hazard and then the rebound from Branislav Ivanovic.
Both sides made changes looking for the win with Fernando Torres and Andre Schurrle thrown on by Jose Mourinho, while Martinez introduced Ross Barkley and Aiden McGeady.
Another substitute Ramires - who came on at the break for Oscar - almost won it when he flashed a shot just wide in the 90th minute, but then Chelsea did win it via Lampard's free-kick which Terry claimed to get a touch to.
It was a timely intervention from the skipper, who returned following a three-game absence with a gluteal muscle problem.
Chelsea had won once in his absence, but they now travel to Galatasaray for the UEFA Champions League last-16 first leg with Didier Drogba's side on Wednesday after a morale-boosting victory.
Mourinho's unbeaten Premier League home record extended to 74 games as luck was on Chelsea's side.
With Romelu Lukaku prevented from facing his parent club, Martinez had selected Lacina Traore for his first Premier League start, only for the giant Ivorian to withdraw after feeling his hamstring in the warm-up - replaced by Steven Naismith.
The visitors started well and would not allow their hosts to settle, disrupting their rhythm with Leon Osman, James McCarthy and Gareth Barry breaking up play in midfield.
When Chelsea got beyond the Toffees trio, they encountered another defensive wall in Sylvain Distin and Phil Jagielka, who acrobatically cleared a menacing Hazard cross.
When that rearguard was breached, Samuel Eto'o wrong-footed Distin and shot left-footed, only for Howard to save.
Kevin Mirallas miscued a shooting chance from the edge of the area and Willian scuffed a shot at Howard as the half closed with Everton the better side.
Chelsea's playmakers struggled in the first half and Oscar was sacrificed at half-time for Ramires - but still Everton looked dangerous.
Osman's shot from the edge of the area clipped Mirallas, and Cech scrambled the ball round the post with a good save.
In an open game, Chelsea had three opportunities in quick succession following a corner.
First Hazard's shot was parried by Howard. Eto'o tried to direct his headed follow-up across goal and into the top corner, but served only to miss the target completely and the goalkeeper then denied Ivanovic.
Torres then replaced Willian and Eto'o pushed wide right before later making way for Schurrle, but still Chelsea were struggling to find the incisive pass, while Everton were playing like visitors, by having just scraps to feed off, unlike in the first half when they were marginally on top.
Chelsea continued to forge forward and Torres blasted into Hazard and wide when the ball would not quite sit for the Belgian and then the Spain striker fired wildly wide.
Terry stood firm as Barkley ran at him in the Chelsea penalty area and Ramires fired narrowly wide at the other end.
Finally the deadlock was broken in added time after Ramires and Jagielka collided and the Chelsea man was awarded a free-kick. Lampard whipped in the ball and Terry got the slightest of touches as Howard failed to deal with it and saw the ball deflect in off his arm.