Amorphous rare earth (RE)-transition metal (TM) ferrimagnetic alloy films have been intensively studied recently in spintronics and ultrafast information storage due to the large perpendicular magnetic anisotropy (PMA), ultrafast magnetization switching, and the presence of magnetization compensation and angular momentum compensation. In this work, we fabricate <i>X</i>/Tb<sub><i>x</i></sub>(Fe<sub>0.75</sub>Co<sub>0.25</sub>)<sub>1–<i>x</i></sub>/<i>X</i> (0.13 ≤ <i>x</i> ≤ 0.32, <i>X</i> = SiO<sub>2</sub>, Pt and W) trilayers by magnetron sputtering, and systematically investigate the magnetic properties and thermal stabilities of the ultrathin TbFeCo films encapsulated by heavy metals Pt and W at room temperature. The 5–50-nm-thick TbFeCo films sandwiched by SiO<sub>2</sub> exhibit PMA with magnetic compensation occurring in Tb concentration <i>x</i> between 0.21 with 0.24. For 3-nm- and 5- nm-thick TbFeCo ultrathin films encapsulated by Pt, however, there is no magnetic compensation observed throughout the composition range 0.13 ≤ <i>x</i> ≤ 0.32 with the film magnetization dominated by the FeCo moment. Nevertheless, the weakened PMA for the Pt/ultrathin TbFeCo/Pt trilayers is completely destroyed after annealing at 250 ℃. When the buffer layer and capping layer of Pt are replaced by W, the ultrathin TbFeCo films show magnetic compensation at 0.21 < <i>x</i> < 0.24, so do the thick TbFeCo films. The effective PMA field (<i>H</i><sub>K</sub>) exceeds 11.5 T for the W/ultrathin TbFeCo/W films near the compensation composition, and remarkably, the <i>H</i><sub>K</sub> decreases slowly on annealing, with PMA maintained even after annealing at 350–400℃. We further prepare [Pt/TbFeCo]<sub>5</sub>/Pt and [W/TbFeCo]<sub>5</sub>/W multilayers to clarify the origin of the huge difference between Pt/ultrathin TbFeCo/Pt and the W counterpart. It is found that there are partial recrystallization and phase separation for TbFeCo layer around the Pt/TbFeCo interface, leading to the disappearance of magnetic compensation and the deterioration of the PMA in the Pt/ultrathin TbFeCo/Pt films. With large PMA, W/ultrathin TbFeCo/W films show the presence of magnetic compensation, and excellent thermal robustness. The present study provides a promising heavy metal/RE-TM heterostructure for spintronic applications.