We study the relation between stellar ages and vertical velocity dispersion (the age-velocity relation, or AVR) in a sample of seven simulated disc galaxies. In our simulations, the shape of the AVR for stars younger than 9 Gyr depends strongly on the merger history at low redshift, with even 1:10-1:15 mergers being able to create jumps in the AVR (although these jumps might not be detectable if the errors on stellar ages are of the order of 30 per cent). For galaxies with a quiescent history at low redshift, we find that the vertical velocity dispersion rises smoothly for ages up to 8-9 Gyr, following a power law with a slope of ∼0.5, similar to what is observed in the solar neighbourhood by the Geneva-Copenhagen Survey. For these galaxies, we show that the slope of the AVR is not imprinted at birth, but is the result of subsequent heating. By contrast, in all our simulations, the oldest stars form a significantly different population, with a high velocity dispersion. These stars are usually born kinematically hot in a turbulent phase of intense mergers at high redshift, and also include some stars accreted from satellites. This maximum in σz is strongly decreased when age errors are included, suggesting that observations can easily miss such a jump with the current accuracy of age measurements.