First-order transitions for random optimization problems in a transverse field