The observed heating of the polar summer mesopause during and after a solar proton event (SPE) is interpreted as a large-scale dynamical response to the temporary diabatic cooling in the lower mesosphere above the summer pole that results from the temporary ozone depletion during an SPE. Our method is based on time slice sensitivity experiments performed with a mechanistic general circulation model. The model response shows that according to the gradient wind balance, the polar lower mesospheric cooling induces an anomalous eastward wind component. As a result, the drag exerted by eastward propagating gravity waves (GWs) shifts to lower altitudes in tandem with a balancing downward shift of the residual circulation. Around the extratropical summer mesopause, this is accompanied by an anomalous large-scale dynamic heating which qualitatively explains the positive temperature response in this region. A quantitative inspection of the zonal momentum and sensible heat budgets reveals that the GW drag response is partly compensated by a downshift of planetary Rossby waves and that about two thirds of the anomalous large-scale dynamic heating around the mesopause is balanced by changes of the direct thermal effects due to GWs, diffusion, and dissipation.