By including the recently introduced thermal shear term that contributes to the spin polarization vector at local equilibrium, we determine longitudinal polarization of $\Lambda$ hyperons emitted from a hot and rotating hadronic medium using the thermal model with single freeze-out. In our analysis, we consider the RHIC top energies and use the model parameters which were determined in the earlier analyses of particle spectra and elliptic flow. We confirm that, unlike the previous calculations done by using only the thermal vorticity, the thermal shear term alone leads to the correct sign of the quadrupole structure of the longitudinal component of the polarization three-vector measured in experiments. However, we find almost complete cancellation between thermal shear and vorticity terms, which eventually leads to disagreement with the data. To clarify the role played by velocity and temperature gradient terms, we present a systematic analysis of different contributions to the longitudinal polarization.