When a large body of fluid is heated from below at a horizontal surface, the heat diffuses into the fluid, giving rise to a gravitationally unstable layer adjacent to the boundary. A consideration of the instantaneous Rayleigh number using the thickness of this buoyant layer as a length scale would lead one to expect that the heated fluid is initially stable, and only becomes unstable after a finite time. This transition would also apply to other situations, such as heating a large body of fluid from the side, where a buoyant upward flow develops near the boundary. In such cases, when the evolving thermal boundary layer first becomes unstable, the time scale for the growth of the instabilities may be comparable to the time scale of the evolution of the background temperature profile, and so analytical approximations such as the quasi-static approximation, where the time evolution of the background state is ignored, are not strictly appropriate. We develop a numerical scheme where we find the optimal growth of linear perturbations to the background flow over a given time interval. Part of this problem is to determine an appropriate measure of the amplitude to the disturbances, as inappropriate choices can lead to apparent growth of disturbances over finite time intervals even when the fluid is stable. By considering the Rayleigh–Bénard problem, we show that these problems can be avoided by choosing a measure of the amplitude that uses both the velocity and temperature perturbations, and which minimizes the maximum growth. We apply our analysis to the problems of heating a semi-infinite body of fluid from horizontal and vertical boundaries. We will show that for heating from a vertical boundary there are large- and small-Prandtl-number modes. For some Prandtl numbers, both modes may play a role in the growth of instabilities. In some cases there is transition during the evolution of the most unstable instabilities in fluids such as water, where initially the instabilities are large-Prandtl-number modes and then morph into small-Prandtl-number modes part of the way through their evolution.