Event-related potentials (ERPs) can reflect the high-level thinking activities of the brain. In ERP analysis, the superposition and averaging method is often used to estimate ERPs. However, the single-trial ERP estimation can provide researchers with more information on cognitive activities. In recent years, more and more researchers try to find an effective method to extract single-trial ERPs, because most of the existing methods have poor generalization ability or suffer from strong assumptions about the characteristics of ERPs, resulting in unsatisfactory results under the condition of a very low signal-to-noise ratio. In this paper, an EEG classification-based method for single-trial ERP detection and estimation was proposed. This study used a linear generated EEG model containing templates of ERP local descriptors which include amplitude and latency, and this model can avoid the invalid assumption about ERPs taken by other methods. The purpose of this method is not to recover the whole ERP waveform but to model the amplitude and latency of ERP components. This method afterwards examined the three machine learning models including logistic regression, neural network, and support vector machine in the EEG signal classification for ERP detection and selected the best performed MLPNN model for detection. To get the utmost out of information produced in the classification process, this study also used extra information to propose a new optimization model, with which outperformed detection results were obtained. Performance of the proposed method is evaluated on simulated N170 and real P50 data sets, and the results show that the model is more effective than the Woody filter and the SingleTrialEM algorithm. These results are also consistent with the conclusion of sensory gating, which demonstrated good generalization ability.