A key process in planet formation is the exchange of angular momentum between a growing planet and the protoplanetary disc, which makes the planet migrate through the disc. Several works show that in general low-mass and intermediate-mass planets migrate towards the central star, unless corotation torques become dominant. Recently, a new kind of torque, called the thermal torque, was proposed as a new source that can generate outward migration of low-mass planets. While the Lindblad and corotation torques depend mostly on the properties of the protoplanetary disc and on the planet mass, the thermal torque depends also on the luminosity of the planet, arising mainly from the accretion of solids. Thus, the accretion of solids plays an important role not only in the formation of the planet but also in its migration process. In a previous work, we evaluated the thermal torque effects on planetary growth and migration mainly in the planetesimal accretion paradigm. In this new work, we study the role of the thermal torque within the pebble accretion paradigm. Computations are carried out consistently in the framework of a global model of planet formation that includes disc evolution, dust growth and evolution, and pebble formation. We also incorporate updated prescriptions of the thermal torque derived from high resolution hydrodynamical simulations. Our simulations show that the thermal torque generates extended regions of outward migration in low viscosity discs. This has a significant impact in the formation of the planets.