Patients with borderline personality disorder (BPD) often engage in dangerous self-injurious behaviors (SIBs) as a maladaptive technique to decrease heightened feelings of distress (e.g. negative feelings caused by social exclusion). The reward system has recently been proposed as a plausible neural substrate, which may influence the interaction between social distress and physical pain processing in patients that engage in SIBs. Using functional magnetic resonance imaging (fMRI) in 20 adult BPD patients with a history of SIBs and 23 healthy controls (HCs), we found a hyper-activation of the nucleus accumbens (NAcc) and amygdala when painful stimuli were presented to BPD patients (but not HCs) in a state of heightened distress, induced via social exclusion. This differential NAcc activity was mediated by anxious attachment style, which is a key developmental feature of the disorder. Altogether, these results suggest a neural mechanism underlying the pathophysiology of SIBs in these patients, which is likely reinforced via the reward system.