Sparse Polyak with optimal thresholding operators for high-dimensional M-estimation