We investigate the stability of π-phase in a polarized superfluid Fermi gas (N↑ > N↓, where Nσ is the number of atoms in the hyperfine state described by pseudospin-σ). In our previous paper [T. Kashimura, S. Tsuchiya, and Y. Ohashi, Phys. Rev. A 82, 033617 (2010)], we showed that excess atoms (ΔN = N↑ - N↓) localized around a potential barrier embedded in the system induces the π-phase at T = 0, where the phase of superfluid order parameter differ by π across the junction. In this paper, we extend our previous work to include temperature effects within the mean-field theory. We show that the π-phase is stable even at finite temperatures, although transition from the π-phase to 0-phase eventually occurs at a certain temperature. Our results indicate that the π-phase is experimentally accessible in cold Fermi gases.