Set a Duckworth-Lewis target of 276 to win in 47 overs, Ireland needed 15 off the last over, bowled by Saeed Ajmal, but O'Brien, who destroyed England with the fastest World Cup century in 2011, hit the fourth ball for six to set up the thrilling finale. However, he couldn't manage a repeat off the last ball to win the game for Ireland, but the boundary was enough to seal the 28th tie in ODI history.
O'Brien, who earlier picked up two wickets when Pakistan batted, finished unbeaten on 84 from just 47 balls, following on from Paul Stirling's rampaging 102-ball century to set up Ireland's victory charge.
Pakistan always appeared to hold the upper hand, getting wickets at vital times, but Mohammad Irfan dropped O'Brien when he was on 19 and that hurt Pakistan.
The Pakistan innings was interrupted four times by rain but only three overs were lost and they scored 144 off 16 overs after the final rain-break to finish on 266 for 5.
Hafeez played a fluent knock on his way to 122. Nasir Jamshed had to retire hurt with back trouble early in his innings, although he returned later, and when Imran Farhat was caught at first slip by Stirling, both openers were back in the pavilion with only 33 on the board.
But the Hafeez-Asad Shafiq partnership put Pakistan in control, broken when Shafiq was caught at long on, his 84 coming off 89 balls with nine boundaries.