Pakistan clinch thriller