For all that early excitement though, Pakistan gradually took the game away from Ireland, thanks in no small part to 22-year-old Imam, who batted with patience and a sound technique to end on a well-made 74*.
But come stumps on Monday's fourth day, Ireland were 319 for seven - a lead of 139 runs, with Kevin O'Brien 118 not out.
9/110 - Mohammad Abbas became the first Pakistan fast bowler to take as many as nine wickets in a Test match since 2010.
Amir, who helped Essex win English cricket's first-class County Championship a year ago, burst onto the world scene as a teenager and at 18 was the youngest bowler to the landmark of 50 Test wickets.
Ireland crumbled to 130 all out in their first attempt at batting in a Test match and it could have been worse if it weren't for man of the match, Kevin O'Brien top scoring with 40 and Surrey's Gary Wilson supporting him on 33no, it could have been so much worse. At that stage, they were still 116 runs behind.
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.
China launches first domestically-made aircraft carrier
This gives them an advantage over the Chinese planes, which rely on their own power and the ski-jump designs on both carriers. Once it is in service, it will be able to accommodate China's Shenyang J-15 fighter jets.
From there, they dragged themselves back into the match and played their way into contention going into the final day against a Test nation stalwart as Pakistan. But Imam, showing the patience that his uncle Inzaman was famous for over his long Test career, finished unbeaten on 74 not out, hitting the winning runs off Tyrone Kane off the final ball of the 45th over, as the tourists wrapped up a five-wicket victory.
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.
"I think it was a fantastic team effort, yesterday belonged to Kevin and very well supported by Tommo and TK".
Ireland started the day on their highly creditable overnight 64 without loss. But overall, all the lads are delighted and they all played a roll throughout the game, so it is great for ourselves and it gives us a lot of belief. It's in the name and you do get tested throughout.
O'Brien was just the fourth player to reach three figures in his country's first men's Test, with Australia's Charles Bannerman, Zimbabwe's Dave Houghton and Bangladesh's Animul Islam the others.
The performance against Pakistan was full of positives, and although the future test match against India will provide a completely different game and possible eye-opener on test cricket - the blocks are there for Ireland to produce a competitive Test cricket team.