The impact of mesoscale moisture variability on the vertical energy transfer through a pre-frontal boundary layer is studied with NOPEX aircraft data. The moisture variability relates to a cold front that passed the area 2 1/2 hours after the observations. We find a density front ahead of the cold front. The large vertical divergence of the turbulent moisture flux in the surface layer is partly related to this moisture variability. Large scale horizontal advection contributes to the observed vertical turbulent flux divergence. The estimated horizontal mesoscale advection term in the budget of sensible heat and moisture is on average small but locally it can be large. This term acts to re-distribute moisture in the boundary layer and leads to sub-grid variations of relative humidity, which is an important quantity for boundary-layer cloud models. The distinct spatial variations of specific humidity are mainly related to synoptic forcing and not to heterogeneity in the surface energy balance.