Vagal flexibility describes the ability to modulate cardiac vagal responses to fit a dynamic range of challenges. Extant theory on vagal function implies that vagal flexibility is a mediating mechanism through which resting vagal activity, a putative individual difference related to self-regulation, affects adaptive behavior and cognition. Nevertheless, little research has directly tested this hypothesis, thereby leaving fundamental mechanisms of vagal function and adaptability unclear. To this end, 47 healthy subjects completed a 5 min baseline followed by Stroop tasks combined with concurrent auditory distractors. There were four different Stroop task conditions that varied the social and emotional content of the auditory distractors. Electrocardiogram was continuously recorded to assess vagal responses to each condition as heart rate variability [root mean square of successive differences (RMSSDs)] reactivity. Vagal flexibility significantly mediated the association between resting vagal activity and stability of inhibition performance (Stroop interference) scores. In particular, higher resting RMSSD was related to higher standard deviation of RMSSD reactivity scores, reflecting greater differences in RMSSD reactivity between distractor conditions (i.e., greater vagal flexibility). Greater vagal flexibility was in turn related to more stability in Stroop interference across the same conditions. The mean of RMSSD reactivity scores across conditions was not significantly related to resting RMSSD or stability in Stroop performance, and mean RMSSD reactivity did not mediate relations between resting RMSSD and stability in Stroop performance. Overall, findings suggest that vagal flexibility may promote the effects of resting vagal activity on stabilizing cognitive inhibition in the face of environmental perturbations.