O'Brien's hundred, which will go down in the history books as his country's first in this format, kept Ireland alive on day four, but he departed to the first ball he faced on Tuesday, edging Abbas to Haris Sohail at slip.
Overly-cautious field placements and Amir's sporadic use were helping, and it was no surprise that it took the return of Pakistan's chief threat to dismiss Gary Wilson, fishing outside off, to give Amir his 100th Test wicket.
The owner of the fastest World Cup century - that stunning 50-ball effort against England in 2011 - took 186 deliveries to reach the mark this time, with 10 fours, and added two more to reach stumps on 118 not out, with Ireland 319-7 and leading by 139.
Pakistan now heads to England for a two-test series, starting next week at Lord's.
At the start of play, Kevin O'Brien's innings came to an end on the first ball of the day.
Ireland's first Test match in worldwide cricket took a lengthy little spell of 144 years to take place but it started with a bang as, in the opening ball of the match, two Irish players collided firmly with Pakistan batsman Imam-ul-Haq, leaving him sprawled on the deck.
Mercedes restore order at top with Hamilton's win
It was the first one-two of the season for Mercedes , which had struggled to keep pace with the Ferraris. Then again, Red Bull can also never be discounted around the twisting streets of the Principality.
A top-notch 74 runs knock of opener Imamul Haq off 121 balls and middle-order batsman Babar Azam's 59 runs innings sealed win for the Sarfaraz-led visiting side.
O'Brien has looked a veteran of the Test arena in his first five-day match. His first 14 Tests saw Amir take 51 wickets at just a fraction over 23 runs apiece, but his 16 completed Tests since his comeback yielded 44 wickets at a more expensive average of 37.25.
Mohammad Amir then sent both Niall O Brien (18 runs) and Captain William Porterfield (32 runs) to the dressing room as Ireland was struggling at 123/4 going into lunch.
When Thompson finally got out for 53 runs to Shadab Khan in the final session, the score stood at 271 for 7, as the lead had been stretched to 91 runs.
But Thompson's single off all-rounder Faheem meant Pakistan would have to bat again, while Kevin O'Brien was looking increasingly assured.
Stuart Thompson just about survived becoming victim number 101 but he, along with Kevin O'Brien, took 14 off two Amir overs to bring Ireland within touching distance of moving in front.