Misbah-ul-Haq and Asad Shafiq rescued Pakistan from a perilous 2-3 to be 80-3 at stumps on the third day of the first Test against the West Indies Saturday as the tourists chased down a 219-run winning target.
Shafiq led the way with 40 not out and Misbah scored an unbeaten 34 before bad light stopped play early.
This followed a dramatic top-order batting collapse that left the visitors wobbling in the third over.
Misbah and Shafiq added 78 for the fourth wicket to deflate the Windies and put the visitors' victory bid back on track.
The unnerving start to Pakistan's chase overshadowed career-best bowling from Saeed Ajmal that undermined the hosts, and led to their dismissal for a modest 152 in their second innings just before tea.
Ajmal finished with six for 42 from 23.5 overs for match figures of 11 for 111.
The Pakistani off-spinner exploited a tricky Guyana National Stadium pitch, getting deliveries to bounce awkwardly and turn sharply to shatter the home team's batting after they resumed from their overnight total of 34 for two.
Ajmal struck with the fifth ball of the day, removing night-watchman Kemar Roach, and added the scalps of Ramnaresh Sarwan, Carlton Baugh, Ravi Rampaul and Devendra Bishoo.
The visitors, however, were held up by a defiant, record last-wicket stand of 48 between Shivnarine Chanderpaul, whose 36 not out was the Windies' top score, and Bishoo, with 24.
Pakistan were then rocked early when Ravi Rampaul trapped Taufeeq Umar lbw and had Azhar Ali caught behind - both for ducks - in the space of three balls in his first over, the second of the innings.
The Pakistanis stumbled further when Kemar Roach had Mohammad Hafeez lbw, following a review of New Zealand umpire Billy Bowden's not-out verdict.
It was the 16th lbw dismissal in the match.
The visitors had a big slice of fortune when Darren Bravo dropped Shafiq - on nought - at fourth slip off Rampaul, and from this point, the momentum shifted Pakistan's way.
Shafiq responded with a flick through mid-wicket for his first boundary off Rampaul, and then glanced the fast-medium bowler for his second four to deep fine leg.
Misbah brought his steadying influence to the crease, and Shafiq benefitted as the two batted resolutely through until the close.
Earlier, Ajmal gave the Pakistanis a bright start to the day, when he had Roach lbw for three before Wahab Riaz had Lendl Simmons caught at silly mid-off for 21, fending a short delivery.
Ajmal remained a constant threat and had Sarwan caught at forward short leg for 11, fending an awkward delivery.
The visitors were gifted the wicket of Brendan Nash run out for three, looking for a second run, and being sent back by Chanderpaul.
Ajmal then struck in the last 15 minutes before lunch when Baugh was caught at mid-wicket, swinging a shortish delivery low to the fielder, leaving West Indies 96 for seven at the interval.
After lunch, left-arm spinner Abdur Rehman continued the rout, when he struck in the second over, trapping Windies captain Darren Sammy lbw for nine.
Ajmal collected his landmark 10th wicket of the match when Rampaul turned an awkward delivery to short leg, and was caught for two, leaving the hosts 104 for nine.
Pakistan then failed to find a way through Chanderpaul and Bishoo for close to two hours, as they established a new record for the last wicket in a Test on the ground.
Ajmal finally brought the innings to an end, when he had Bishoo caught at slip, edging a delivery that exploded from the pitch.
Pakistan are seeking their maiden Test series victory in the Caribbean.
Brief scores
West Indies 226 and 152 (Chanderpaul 36*, Ajmal 6-42)
Pakistan 160 (Shafiq 40*) and 80 for 3
Status Pakistan need 139 runs to win