Regulation of phenotypic variability by a threshold-based mechanism underlies bacterial persistence