After seeing his compatriot fly in FP4, the Pramac Racing man knuckled down in Q2 to clinch a last-gasp front row spot