Heating-induced threshold current detuning with different cavity resonances of AlInGaAs-AlGaAs vertical-cavity surface-emitting lasers (VCSELs) was studied based on gain spectrum analysis and threshold current construction as functions of cavity resonance wavelength and temperature. The quantitative correlations between gain peak, cavity resonance and the minimal threshold current were established. The results showed that the minimal threshold current was in agreement with the gain peak in wavelength only at the temperatures of 300-320 K. Higher temperatures led to a detuning difference between the gain peak and the minimal threshold current relative to the cavity resonance due to band-like nature of the states. In addition, this theoretical analysis about thermal tuning of the cavity resonance pointed out that the wavelength of cavity resonance shifted in an exponential function of temperature. The linear approximation was consistent with the experimental results in the temperature range 300-400 K. A new approach for the gain offsetting is provided so that the minimum in threshold currents can be aligned with the cavity resonance, instead of doing it with the gain peak to achieve the lowest threshold current of the VCSEL at a given temperature.