The relative contributions of autonomic arousal and of cognitive processing to cortical activity during anticipation of pain, and the role of changes in thalamic outflow, are still largely unknown. To address these issues, we investigated with functional magnetic resonance imaging (fMRI) the activity of the contralateral mesial hemispheric wall in 56 healthy volunteers while they expected the stimulation of one foot, which could be either painful or innocuous. The waiting period was characterized by emotional arousal, a moderate rise in heart rate, and by increases in mean fMRI signals in the medial thalamus, mid- and posterior cingulate cortex, and in the putative foot area of the primary somatosensory and motor cortex. The same brain regions, excepting posterior cingulate, were also activated by somatosensory stimulation. We identified by cross-correlation analysis a cluster population whose fMRI signal time course was related to the mean heart rate (HR) profile, showing selective changes of activity during the waiting period. Positively correlated clusters were found mainly in sensorimotor areas, mid- and posterior cingulate, and dorsomedial prefrontal cortex. Negatively correlated clusters predominated in the perigenual anterior cingulate and ventromedial prefrontal cortex. HR clusters had different characteristics from, and showed limited spatial overlap with, clusters whose fMRI signals were related to the psychophysical pain intensity profile; however, both cluster populations were affected by anticipation. These findings unravel a complex pattern of brain activity during uncertain anticipation of noxious input, likely related both to changes in the level of arousal and to cognitive modulation of the pain system.