Batting alongside Nathan Lyon, Paine ended the day unbeaten on 61 and ensured that no more wickets were lost after Shah had removed Usman Khawaja, Mitchell Starc and Peter Siddle in the space of eight balls.
At one point, Khawaja and Paine looked likely to bat through the innings and save the Test. Set a daunting 462 to win, they were 287/5 at tea and were in a good position to bat through the final session.
The two brought up a fifty-run partnership for the sixth wicket – only the second instance of Australia recording a stand of 50 or more for the sixth wicket in the fourth innings of a Test match in Asia.
However, it was Yasir Shah who took it upon himself to turn the game on its head as he struck thrice in quick succession to leave the hosts on the brink of defeat after yet another collapse.
He trapped Usman Khawaja leg-before and then got Mitchell Starc caught out by Babar Azam at short square leg. When he trapped Peter Siddle for nought, the writing looked on the wall.
Instead, Paine dug deep. He survived a few nervy moments – including completely misreading a ball from Shah that caught the inside edge but ran away to the boundary – and saw the remaining overs out. He was aided by Lyon, who played out 34 balls.
Earlier in the day, Khawaja had brought up an invaluable 100-run partnership for the fourth wicket with Travis Head.
Pakistan were flustered after they failed to get a single wicket in the first session after Australia had resumed play at 136-3.
Khawaja brought up his century with a single to short mid-wicket off Mohammad Hafeez's bowling. The relief on his face was evident as the opener's record in Asia before this Test was quite mediocre.
Pakistan had looked to take early wickets at the beginning of the day after Australia were left at 136-3 at the close of play on the fourth day, but nothing seemed to work for skipper Sarfraz Ahmed.
Ahmed made multiple bowling changes but none of them succeeded in getting the much-needed breakthrough, although they were left to rue a missed chance at a review.
They could have had Head leg-before off Yasir Shah’s bowling on 44, but Sarfraz chose not to review the decision. However, replays showed the ball was going on to clearly hit the wickets.
Pakistan were finally given some reward for their efforts when they took the second new ball as soon as it was due. Hafeez trapped Head leg-before with the very first ball.
Yasir Shah then took his first wicket of the match when he dismissed Marnus Labuschagne for 13. His flurry of wickets towards the end of the day perfectly set up a thrilling end, but Paine ensured there was no celebrations for Pakistan fans at the end of the match.
Babar AzamMarnus LabuschagneMohammed HafeezPak vs AusPakistan vs Australiapakistan vs australia 2018peter siddleTim PaineUsman KhawajaYasir Shah
First Published: October 11, 2018, 7:19 PM IST