We consider the evolution of a long and thin vertically aligned axisymmetric viscous thread that is composed of an incompressible fluid. The thread is attached to a solid wall at its upper end, experiences gravity and is pulled at its lower end by a fixed force. As the thread evolves, it experiences either heating or cooling by its environment. The heating affects the evolution of the thread because both the viscosity and surface tension of the thread are assumed to be functions of the temperature. We develop a framework that can deal with threads that have arbitrary initial shape, are non-uniformly preheated and experience spatially non-uniform heating or cooling from the environment during the pulling process. When inertia is completely neglected and the temperature of the environment is spatially uniform, we obtain analytic solutions for an arbitrary initial shape and temperature profile. In addition, we determine the criteria for whether the cross-section of a given fluid element will ever become zero and hence determine the minimum stretching force that is required for pinching. We further show that the dynamics can be quite subtle and leads to surprising behaviour, such as non-monotonic behaviour in time and space. We also consider the effects of non-zero Reynolds number. If the temperature of the environment is spatially uniform, we show that the dynamics is subtly influenced by inertia and that the location at which the thread will pinch is selected by a competition between three distinct mechanisms. In particular, for a thread with initially uniform radius and a spatially uniform environment but with a non-uniform initial temperature profile, pinching can occur either at the hottest point, at the points near large thermal gradients or at the pulled end, depending on the Reynolds number. Finally, we show that similar results can be obtained for a thread with initially uniform radius and uniform temperature profile but exposed to a spatially non-uniform environment.