Pakistan seal win on dramatic day