Vision based inspection system, as an effective rail head surface defect detection method, is widely used. However, the rail images taken by the imaging system might be blurred, and it restricts the recognition accuracy. In this paper, we proposed an effective deblurring method: learned partial differential equation (L-PDE) for Gaussian-blur images, which is used as a preprocessing for Rail Head Surface Defect Detection. We first analyze the image deblurring problem and the regularization methods by the inverse problem theories, and then propose a generalized model: L-PDE, which is the extension of traditional PDE based image deblurring methods, e.g. Tikhonov model, total variation (TV) model. A filter-learning model is built and 25 filters are learned. Compared to traditional image deblurring methods, L-PDE model achieve much better results. The experiments show that L-PDE is an effective preprocessing method for rail head surface defect detection.