  We present a new investigation of the thermal history of the intergalactic
medium (IGM) during and after reionization using the Lyman-$\alpha$ forest flux
power spectrum at $4.0\lesssim z\lesssim5.2$. Using a sample of 15
high-resolution spectra, we measure the flux power down to the smallest scales
ever probed at these redshifts ($-1\lesssim \log(k/$km$^{-1}$s)$\lesssim
-0.7$). These scales are highly sensitive to both the instantaneous temperature
of the IGM and the total energy injected per unit mass during and after
reionization. We measure temperatures at the mean density of
$T_{0}\sim7000$-8000 K, consistent with no significant temperature evolution
for redshifts $4.2\lesssim z\lesssim5.0$. We also present the first
observational constraints on the integrated IGM thermal history, finding that
the total energy input per unit mass increases from $u_{0}\sim4.6$ ${\rm eV}$
$m_{\rm p}^{-1}$ to 7.3 eV $m_{\rm p}^{-1}$ from $z\sim 6$ to $4.2$ assuming a
$\Lambda$-CDM cosmology. We show how these results can be used simultaneously
to obtain information on the timing and the sources of the reionization
process. Our first proof of concept using simplistic models of instantaneous
reionization produces results comparable to and consistent with the recent
Planck constraints, favoring models with $z_{\rm rei}\sim 8.5^{+1.1}_{-0.8}$.
