Most existing deformation warning methods for the safety of surrounding rock rely on empirical index or complicated numerical simulation and are unable to accurately and quickly determine the critical warning deformation, so an accurate determination method of critical warning deformation based on rock strength was investigated by the complex function theory in this study. The complex function theory was used to demonstrate that the elastic deformation of surrounding rock at a point is linearly related to its circumferential stress. Based on this demonstration, the critical warning deformations for blue warning, yellow warning, and red alert can be theoretically determined according to the crack initiation stress, dilatancy stress, and uniaxial compressive strength of surrounding rock, respectively. In addition to these critical stresses, the cavern’s shape, the in-situ stress, the deformation properties, and the position of the surrounding rock were also considered in the determination. The accuracy of the proposed theoretical method was verified by a finite element simulation of an example tunnel. Subsequently, the method was applied to the underground powerhouse on the left bank of the Baihetan hydropower station. Compared with the on-site monitoring displacements of the surrounding rock, the resulting warning displacements could accurately indicate the safety status of all monitoring areas around the cavern after each layer of excavation. In addition, the resulting warning positions, warning times, and warning grades matched the on-site failures of the surrounding rock very well. Thus, the proposed method is highly reliable and can be used for real-time warning of underground engineering.