Kevin O'Brien was left distraught after Ireland were denied a famous one-day victory against Pakistan.