Traumatic experiences in childhood can alter behavioural responses and increase the risk for psychopathologies across life, not only in the exposed individuals but also in their progeny. In some conditions, such experiences can however be beneficial and facilitate the appraisal of adverse environments later in life. Here we expose newborn mice to unpredictable maternal separation combined with unpredictable maternal stress (MSUS) for 2 weeks and assess the impact on behaviour in the offspring when adult. We show that MSUS in male mice favours goal-directed behaviours and behavioural flexibility in the adult offspring. This effect is accompanied by epigenetic changes involving histone post-translational modifications at the mineralocorticoid receptor (MR) gene and decreased MR expression in the hippocampus. Mimicking these changes pharmacologically in vivo reproduces the behavioural phenotype. These findings highlight the beneficial impact that early adverse experiences can have in adulthood, and the implication of epigenetic modes of gene regulation.