Surface-wave analysis methods have been widely applied to construct near-surface shear-wave velocity structures. Whether it is an active source or passive source, the near-surface shear-wave velocity structure is obtained by inverting the surface-wave dispersion curve. In order to solve the problems of low inversion efficiency and poor inversion results in traditional surface-wave exploration, we have studied the surface-wave inversion methods based on deep learning technology. In this study, we propose a long short-term memory (LSTM) surface-wave inversion method based on the first height last velocity (FHLV) loss function. The core of our proposed method is the FHLV loss function consisting of two parts: a speed loss and a thickness loss, which improves the overall prediction accuracy through optimizing the learning process of the thickness parameter by the network. To verify the accuracy of the proposed LSTM surface-wave inversion method based on the FHLV loss function, experiments are conducted on both synthetic and real datasets. The results show that our proposed method can efficiently and accurately invert the near-surface shear-wave velocity structure.