Pakistani bowlers didn't get any more wickets in the last session barring the one of Thompson, as the Irish team found themselves at 319 for the loss of 7 wickets at stumps on Day Four in the Dublin test.
Babar Azam also scored a fifty in this innings.
O'Brien himself, Ireland's first Test centurion, had not added to his overnight 118 when he was caught behind and despondently departed having faced 217 balls and hit 12 boundaries.
Abbas wrapped up the innings, and his second five-for in Tests, when he bowled Rankin (6) and Tyrone Kane (14) off inside-edges - but it was then Ireland's pacemen who came to the fore.
Kevin O'Brien targets victory after hitting Ireland's first Test ton
An innings defeat was still a possibility when Amir, given a jail sentence and banned from cricket for five years as a result of his involvement in a spot-fixing scandal during the 2010 Lord´s Test, took his 100th wicket in 31 matches at this level when Gary Wilson was held in the slips by Haris Sohail.
The unanimous verdict from the cricket world showed that it was great to see Ireland play Test cricket, and even greater to come out with an extremely competitive performance on their Test debut.
With the lead of 139 runs in the bank and Kevin O Brien still unbeaten on 118, Ireland sense a little hope for victory.
The 11th Test nation's optimism began to dissipate with Imam and Azam at the crease, though the former was fortunate an edge dropped short off Murtagh and the latter was nearly undone by a Rankin yorker.
Seattle OKs taxing companies like Amazon to aid the homeless
City coffers are expected to receive around $48million per year under the new proposal, down from $80million under the original. The Seattle region had the third-highest number of homeless people in the United States and saw 169 homeless deaths past year .
Kevin O'Brien is handed the man of the match award by Ross McCollum and Rameez Raja.
When Pakistan slipped to 14 for three in pursuit of 160, the Irish were in with a sniff of marking their inaugural men's Test with a victory to compare with any.
The now 26-year-old Amir's cricket career nearly came to an end following his involvement in a spot-fixing scandal during a 2010 Test against England at Lord's.
The third-wicket partnership had only got to 25 when O'Brien was bowled, playing across the line to Amir, and when Porterfield followed for the addition of only one more run, a good diving catch to his left by the keeper, Ireland were 95-4.
DR Congo: 2 kidnapped British tourists released
The park, which is a Unesco world heritage site, is home to critically-endangered mountain gorillas, lions, elephants and hippos. Two Britons kidnapped in a national park in DR Congo have said they are "very grateful" after their release.
Chasing 160, Imam (74 not out) and Azam (59) forged a crucial partnership to guide Pakistan to a comfortable victory after the visitors had slipped to 14/3.
"I think it was a fantastic team effort, yesterday belonged to Kevin and very well supported by Tommo and TK". Pakistan have a lot of good young players coming up, and the chance been provided to these young lads in their young careers is giving Pakistan cricket a bright future.
Cricket Ireland have said that one or two Test matches a year will probably be the limit that the Ireland side will play. That's the character we've had and to be able to bring that into first Test is pleasing.
But after a glorious four days in Malahide, following a washed-out opening day, there is now no question that the 11th team to play Test cricket are in any way out of place.
Bethesda unveils first gameplay footage of Rage 2
Between the two I expect we'll see Rage 2 in depth, plus everything else this first teaser is missing: Release date, et cetera. As promised in the video, RAGE 2 will include a vast Open World in which there's no law.