Based on mesoscale lattice Boltzmann simulations with the "Shan-Chen" model, we explore the influence of thermocapillarity on the breakup properties of fluid threads in a microfluidic T-junction, where a dispersed phase is injected perpendicularly into a main channel containing a continuous phase, and the latter induces periodic breakup of droplets due to the cross-flowing. Temperature effects are investigated by switching on-off both positive-negative temperature gradients along the main channel direction, thus promoting a different thread dynamics with anticipated-delayed breakup. Numerical simulations are performed at changing the flow rates of both the continuous and dispersed phases, as well as the relative importance of viscous forces, surface tension forces, and thermocapillary stresses. The range of parameters is broad enough to characterize the effects of thermocapillarity on different mechanisms of breakup in the confined T-junction, including the so-called "squeezing" and "dripping" regimes, previously identified in the literature. Some simple scaling arguments are proposed to rationalize the observed behavior, and to provide quantitative guidelines on how to predict the droplet size after breakup. © 2016 American Physical Society.