We consider the variational problem associated with the Freidlin–Wentzell Large Deviation Principle (LDP) for the Stochastic Heat Equation (SHE). For a general class of initial-terminal conditions, we show that a minimizer of this variational problem exists, and any minimizer solves a system of imaginary-time Nonlinear Schrödinger equations. This system is integrable. Utilizing the integrability, we prove that the formulas from the physics work (see Alexandre Krajenbrink and Pierre Le Doussal [Phys. Rev. Lett. 127 (2021), p. 8]) hold for every minimizer of the variational problem. As an application, we consider the Freidlin–Wentzell LDP for the SHE with the delta initial condition. Under a technical assumption on the poles of the reflection coefficients, we prove the explicit expression for the one-point rate function that was predicted in the physics works (see Pierre Le Doussal, Satya N. Majumdar, Alberto Rosso, and Grégory Schehr [Phys. Rev. Lett. 117 (2016), p. 070403]; Alexandre Krajenbrink and Pierre Le Doussal [Phys. Rev. Lett. 127 (2021), p. 8]). Under the same assumption, we give detailed pointwise estimates of the most probable shape in the upper-tail limit.