Atoms and molecules, and in particular CO, are important coolants during the evolution of interstellar star-forming gas clouds. The presence of dust grains, which allow many chemical reactions to occur on their surfaces, strongly impacts the chemical composition of a cloud. At low temperatures, dust grains can lock-up species from the gas phase which freeze out and form ices. In this sense, dust can deplete important coolants. Our aim is to understand the effects of freeze-out on the thermal balance and the evolution of a gravitationally bound molecular cloud. For this purpose, we perform 3D hydrodynamical simulations with the adaptive mesh code FLASH. We simulate a gravitationally unstable cloud under two different conditions, with and without grain surface chemistry. We let the cloud evolve until one free-fall time is reached and track the thermal evolution and the abundances of species during this time. We see that at a number density of 10$^4$ cm$^{-3}$ most of the CO molecules are frozen on dust grains in the run with grain surface chemistry, thereby depriving the most important coolant. As a consequence, we find that the temperature of the gas rises up to $sim$25 K. The temperature drops once again due to gas-grain collisional cooling when the density reaches a few$times$10$^4$ cm$^{-3}$. We conclude that grain surface chemistry not only affects the chemical abundances in the gas phase, but also leaves a distinct imprint in the thermal evolution that impacts the fragmentation of a star-forming cloud. As a final step, we present the equation of state of a collapsing molecular cloud that has grain surface chemistry included.