Brendan Rodgers’ side needed an 88th-minute Luis Suarez goal to take them through to Friday’s Europa League draw, after David Templeton had levelled the score on aggregate three minutes earlier following a mistake by Liverpool goalkeeper Pepe Reina.
Liverpool manager Rodgers recalled Steven Gerrard and Luis Suarez for the game at Anfield.
Rodgers rested the pair for last week’s 1-0 win at Tynecastle, but the pair returned in a strong-looking Liverpool team. Teenager Adam Morgan made his full Liverpool debut and partnered Suarez up front.
Captain Marius Zaliukas started for Hearts after recovering from a thigh complaint.
Goalkeeper Jamie MacDonald returned after missing last week’s game on paternity leave, while his replacement Peter Enckelman is nursing a shoulder injury so teenager Jack Hamilton took his place on the bench.
Hearts were extremely unlucky not to get a result in the first leg at Tynecastle, with Andy Webster’s late own goal the difference between the sides.
They started well in the return leg, with Callum Paterson’s early volley whistling just wide of Reina's goal.
Liverpool came back strongly and on the quarter-hour mark, Stewart Downing's deep cross found Gerrard at the back post, but Suarez was unable to get his effort from the knock-down away under pressure from the Hearts’ defence.
Hearts were looking for a penalty ten minutes later after a one-two on the edge of the area between Templeton and Paterson, with Paterson eventually going down under a Jamie Carragher challenge. However, referee Vladislav Bezborodov correctly decided that Paterson had made the most of it and waved play on.
Gerrard then almost conjured a goal out of nothing in the 29th minute.
Faced with a wall of white shirts, he skipped past Webster and Darren Barr and powered towards goal but MacDonald was out quickly to smother as the England captain attempted to chip the ball into the net from the left-hand side of six-yard box.
Just after the half-hour mark, Morgan had a tap-in goal ruled out when the Russian linesman ruled that the ball was over the line after Suarez brought the ball back from the touchline.
Hearts, superbly led by Webster and Zaliukas at the back, were magnificent in defence but Liverpool eventually began to find holes in the Scottish Premier League side’s backline as their legs grew wearier.
On 64 minutes, Jordan Henderson's through ball split the Jambos’ defence and found Suarez, but instead of hitting the target, the striker inexplicably procrastinated before seeing his shot hit the near post with Ryan McGowan doing well to close the angle.
With ten minutes to go, John McGlynn’s side were still in the tie, but aware that time was running out for the goal they needed to level the tie.
The Hearts’ attacks began to get a little more desperate, the shots started to become more optimistic. But it was through such an effort that they drew level on aggregate with five minutes of the game remaining.
Templeton was 25 yards from goal, and his right-foot strike from was well hit but straight at Reina. Unbelievably, the Spaniard let the ball squirm from his grasp, and drop over the line.
The winner came three minutes later, and was helped in part by an ill-timed slip from Webster as he came to meet Suarez 30 yards from goal. The Uruguayan slipped into the left-hand edge of the penalty area, and though marked by Zaliukas, he managed to squirt a shot past Mac Donald at his near post to make it 1-1 on the night, and send Liverpool into the Europa League group stages.
It was a result they deserved, but one they threatened briefly to let slip through their hands.