The dynamics of the demagnetization induced by an ultrashort laser pulse in GdCo and GdCoFe alloys is shown to be substantially different from the expected trend. We find that the intersublattice exchange interaction between Gd and Co(Fe) is used as an additional route of heat transfer during the demagnetization process and leads to a temporary cooling of the Co(Fe) spin subsystem. The observed results are described by a four-temperature model (4T model) in which electrons, lattice, and 4f and 3d spins represent four reservoirs of heat energy. In this model, the coupling between the electron and spin reservoirs is responsible for an ultrafast demagnetization, while the intersublattice exchange coupling gives rise to an immediate remagnetization and serves as a thermal link between the Co(Fe) and Gd spins.