Llorente's winner came very late on, volleying home at the back post to ensure three points for the Welsh side.
Jonny Evans scored the game’s first goal, meeting a corner with a towering header as Kristoffer Nordfeldt was caught in no man’s land.
Ayew then equalised in the 72nd minute, after Llorente’s header found the Ghanaian striker inside the box with a simple finish.
The result sees West Brom finish the season in 10th, while Swansea move up to 15th.
Evans’ header was the story of the first half
Swansea started the brighter of the two teams, as the Liberty Stadium was a party atmosphere after the side secured Premier League football for another year last weekend.
Going into the game, Swansea manager Paul Clement had won eight of his 18 Premier League games this season, while Francesco Guidolin, Bob Bradley and Alan Curtis managed just three between them.
Swansea were also unbeaten in their last four Premier League games, taking 10 points from a possible 12 and conceding just once on this run.
The first real chance fell to Salomon Rondon, who connected with a cross in a headed effort that was easily saved by Nordfeldt.
Swansea will know all about Rondon’s aerial threat, having scored a hat-trick of headers in the reverse fixture this season against the Welsh side.
Leroy Fer had the home side’s first chance, linking well with Gylfi Sigurdsson on the edge of the box before blazing his shot well over from a tight angle.
Rondon was then denied again by Nordfeldt, who made his first appearance of the season today having been an unused substitute in every other Premier League game.
West Brom then took the lead through Evans, meeting a corner at the back post and finished easily with little to no marking around the defender.
The goal is the first that Swansea have conceded from a set-piece since Clement was appointed as manager, a remarkable run considering how poor the side have been at set-plays over the past couple of years.
Second half all Swansea
In the first action of the second half, Chris Brunt tried to catch out Nordfeldt with a free-kick after the Swede had left a lot of room to aim at but the goalkeeper was able to get back in time and comfortably save the effort.
Leon Britton then came to Swansea’s rescue, after Rondon robbed Federico Fernandez, closed in on goal but seemingly out of nowhere Swansea’s stalwart and captain was able to crucially block the left-footed strike.
Sigurdsson’s corner was flicked on by Fer to the back post to a free Fernandez at the back post with the goal gaping at his mercy, but fortunately for the travelling team he somehow put his header wide of the goal as Swansea pushed for an equaliser.
The equaliser came from Sigurdsson’s lofted free-kick into Llorente, who knocked the ball across the six-yard box where Ayew was waiting to finish.
The goal is Ayew’s first for the club, having arrived in January and played a big role during the business end of the season alongside Llorente up front.
Ayew then almost doubled his tally, twisting in and out before firing a shot towards goal that was just the wrong side of Ben Foster’s post.
Llorente then sent the Swansea fans into raptures, volleying home from substitute Luciano Narsingh's cross.
The goal is Llorente's 15th of the season, almost all of which have been vital goals as he has propelled the club to safety.
West Brom almost equalised through Evans, but Nordfeldt was on hand to save well to rescue the win.
Regardless of the result, both sets of fans will walk away happy looking back on this season.
Swansea miraculously stayed in the Premier League, despite being two points behind Sunderland when Clement was appointed as manager.
Despite tailing off after reaching 40 points, West Brom finish in the top-half, which was the target set out to Tony Pulis by the club’s owners.
Both clubs will seek to build on what they have achieved this season, and questions will be posed, but today is a good day for both Swansea and West Brom.