We have analyzed the effects of photoelectric heating by dust grains in photoionization models of planetary nebulae. We have shown that this process is particularly important if planetary nebulae contain a population of small grains. The presence of such grains would solve a number of problems that have found no satisfactory solution so far: i) the thermal energy deficit in some objects inferred from tailored photoionization modelling; ii) the large negative temperature gradients inferred directly from spatially resolved observations and indirectly from integrated spectra in some planetary nebulae; iii) the fact that the temperatures derived from the Balmer jump are smaller than those derived from [O III] 4363/5007; iv) the fact that the observed intensities of [O I] 6300 are often larger than predicted by photoionization models. In presence of moderate density inhomogeneities, such as inferred from high resolution images of planetary nebulae, photoelectric heating would boost the temperature of the tenuous component, which would then better confine the clumps. The temperature structure of such dusty and filamentary nebulae would solve the long standing problem of temperature fluctuations posed by Peimbert (1967, ApJ, 150, 825).