In the present manuscript, a nonclassical beam theory is developed to analyze free vibration of piezoelectric nanobeam by considering surface effects resting on Winkler-Pasternak elastic medium and thermal loading with axial preload. The nonclassical Eringen theory is utilized to incorporate the length-scale parameter to account for the small-scale effect, while the Gurtin-Murdoch model is employed to inject the surface effects including surface elasticity, surface stress and surface density. The governing equations are derived using Hamilton's principle in the framework of Euler-Bernoulli beam theory. The governing partial differential equations of motions of system are reduced to a set of algebraic equations with the help of differential transformation method as a semi-analytical-numerical. The mathematical derivations and numerical results are presented in detail for various boundary conditions. Some numerical examples are illustrated in order to investigate the effect of several parameters such as the nonlocal parameter, piezoelectric voltage, surface effects, temperature change, axial preload and elastic medium parameters. Moreover, it is also indicated that the numerical results have good agreement with previous studies.