With Norwich losing at home to Manchester United and Newcastle only drawing at relegated Aston Villa, victory over Everton in their penultimate game will keep Sunderland up and send the Canaries and Magpies down.

A delighted Allardyce said: "Our destiny is in our own hands. We have turned it around with a big victory.

"Obviously Newcastle drawing and Norwich losing has put us in a very good position. Now we must take full advantage of that and try to finish the job off on Wednesday.

"But we have still got to be very professional and very driven to try to make sure that, when we finish that game, we are safe.

"Hopefully we will not jangle our nerves any longer than we need. Nobody wants that - the staff, the fans, the players and certainly not me.

"There were so many people biting their nails today in the last few minutes - it was such a tense atmosphere."

Sunderland had to fight all the way to win a game which looked to be Chelsea's for the taking at half-time.

Wahbi Khazri had dragged them back into it with a stunning volley to cancel out Diego Costa's 14th-miunute opener, only for Nemanja Matic to restore the visitors' lead in stoppage time at the end of the first half.

However, Fabio Borini's 67th-minute equaliser set the stage for Jermain Defoe to win it with his 18th goal of the season three minutes later. It was his first goal at home since January 2.

Allardyce praised the veteran striker. "That's 15 goals now - is it 18 in all competitions? - in a team that's been in the bottom three most of the season. It's a miraculous return. I have to say, though, he's not been starved of service.

"For a struggling side at the bottom, we have given him some good service, some good opportunities to score those goals, so it's not as if he hasn't had the opportunities. We have served him well in that department.

Wrong

"For me, it's a pleasing factor that he scores goals continuously while he plays up front on his own. Some people tried to suggest that he couldn't do and he has proved them wrong. He certainly can play that role very, very well."

It proved an agonisingly tense conclusion to the game, even for Allardyce, who admitted earlier this week that he uses transcendental meditation to calm his nerves.

The 61-year-old said: "For a manager, today's match had all the thrills and spills and the worries and the tension that you get at this level of football.

"It's been the thrills and spills, the ups and downs, and then of course a tense last few minutes, particularly when we gave the free-kick away on the edge of our box.

"I didn't know whether I wanted to shoot the referee or I wanted shoot the defender who brought Costa down, but we managed to survive it and that's what's very important, we got the three points."

Having lost the lead twice, Chelsea's day went from bad to worse when John Terry was sent off.

Terry was dismissed for the second time this season and the sixth time in the Premier League after being shown the yellow card for the second time in the closing stages.

That means he will be suspended for Wednesday's match against Liverpool at Anfield and Sunday's visit of champions Leicester to Stamford Bridge.

As a result, the 35-year-old defender, who made his debut in October 1998 and is out of contract this summer, appears to have pulled on the blue shirt for the last time after revealing in January that he would be leaving Stamford Bridge.

The club has insisted an offer may be forthcoming, with incoming head coach Antonio Conte having a major say in the final decision, but there has been no sign of one so far and caretaker boss Guus Hiddink remains uncertain over the former England defender's future.

Asked if Terry's appearance on Wearside would be his last, Hiddink said: "For the club, I don't know, but it's sad, of course, that he was sent off for a second yellow, and it's the second sending-off, which by the rules means he will suspended (for both games).

"I think the referee (Mike Jones) was too close to the incident. Normally we say, 'Referee, be close to what can happen', but I think he was too close and an impulsive reaction made him draw the yellow card.

Intensive

"With a little bit more distance, 10 yards more, he could have thought, 'Hey, these two guys went intensively for the duel' - it was an intense game and he has to consider a bit the intensity of the game and this duel as well."

Terry has been linked with a move to China, the Middle East and Major League Soccer.

Asked if it would be a sad way for Terry to end his Chelsea career, Hiddink said: "Yes, of course. We don't know what his future is at this moment but, for this season, it's sad because it would have been lovely for him to play against Leicester, the champions, and have a very nice party game."

Terry cut a disconsolate figure in the away dressing room after the game with Hiddink revealing: "Of course, he was sitting and staring. You can imagine what his mood was like.