Since crystalline grain-boundary subphases are expected in SmFe12-based permanent magnets, stable crystal structures dependent on temperatures and compositions are examined by first-principles thermodynamics. The free-energy landscape of ternary Sm-Cu-Fe is constructed with self-consistent phonon theory to overcome the dynamical instability problem, where a barrier between binary B2 Sm-Cu and bcc Fe is found. Cu-rich B2 Sm-Cu is substantially stabilized by phonons as well as by the configurational entropy. Furthermore, Fe atoms in the Cu sublattice of B27 SmCu contribute to the relative phase stabilization. These results indicate the existence of B2-B27 two-phase equilibria expanding the stable composition region of nonmagnetic SmCu-based intermetallics.