Pakistan lost their last five wickets for just 17 runs during a dramatic collapse