Psychological pain is a robust predictor of suicide attempts in patients with major depressive disorder (MDD). However, whether suicide and psychological pain share a common neural basis remains unclear. Patients with MDD (n = 64) and healthy controls (HC) (n = 35) were recruited and patients were allocated to two groups: those with a history of suicide attempts (MDD-SA) (n = 25) and those without such a history (MDD-NSA) (n = 39). All participants completed the measurements and underwent functional magnetic resonance imaging to investigate the resting-state static and dynamic brain functional networks in default mode (DMN), central executive (CEN), salience (SN), and basal ganglia (BGN) networks. The MDD-SA group scored higher in pain avoidance than the MDD-NSA and HC groups. Functional connectivity within the dorsal DMN in the MDD-SA group was greater than that in the MDD-NSA and HC groups, and was significantly correlated with pain avoidance and suicide attempts. Dynamic functional connectivity analysis revealed that the proportion of State I in the fraction windows in the MDD-SA group was higher than those in the MDD-NSA and HC groups. Therefore, the increased functional connectivity within the dorsal DMN and segregation of networks may represent potential biological markers for suicide attempts related to psychological pain processing.