The Eagles had hit back from 3-1 down to lead 4-3 before the Spanish striker grabbed a dramatic late brace to send the home fans into raptures.
Palace had started the match brightly and should have taken the lead after only six minutes but, after a goalmouth scramble, Christian Benteke lashed his shot from only 10 yards over the bar.
Alan Pardew’s side were dominant in the early stages and when the Swans finally got forward, Gylfi Sigurdsson’s weak effort was saved by Wayne Hennessey.
The visitors deservedly took the lead in the 19th minute when the impressive Benteke flicked the ball on to Wilfried Zaha, who beat Neil Taylor before driving a low shot past Lukasz Fabianski.
Nine minutes before half-time Swansea pulled level when Sigurdsson scored with a superb free-kick after Jason Puncheon’s needless foul.
Palace almost immediately retook the lead when Zaha headed against the bar after being set up by Yohan Cabaye, but they suffered a major blow at the start of the second half when Connor Wickham had to be stretchered off the pitch after sustaining what appeared to be a serious knee injury, with Andros Townsend replacing the former Sunderland forward.
James Tomkins’ superb last-ditch tackle denied the lively Modou Barrow a goalscoring opportunity on the hour mark before Leroy Fer scored twice in three minutes to put the Swans 3-1 ahead.
Tomkins reduced the deficit in the 75th minute and seven minutes later Zaha’s cross was headed into his own net by Jack Cork to make it 3-3.
When Benteke turned the ball home from two yards out it seemed as though Palace were going to bring their losing run to an end, only for Llorente to deflect Sigurdsson’s effort past Hennessey before poking the ball home from a yard out, as Swansea recorded their first Premier League victory since the opening day of the campaign.
Pedro stepped off the bench to send Chelsea into the FA Cup semi-finals after they beat Leicester 2-1 at the King Power Stadium on Sunday evening.
RB Leipzig came from behind at the Red Bull Arena to end a run of four winless games and defeat Bundesliga leaders Bayern Munich 2-1 on Sunday.