Background: It is very important for breast cancer patients undergoing surgery to choose an opioid that has little effect on the immune system. The aim of this study is to compare the effects of dezocine or sufentanil on postoperative pain and Th1/Th2 balance in patients undergoing breast cancer surgery. Methods: Data from 92 breast cancer patients from January 2019 to July 2020 at Foshan Second People's Hospital (Guangdong, China) were analyzed. Sufentanil (SF) was used in group SF (n = 44) and dezocine (DE) in group DE (n = 48). The Visual Analog Scale (VAS) scores were assessed, and the percentages of Th1 cells and Th2 cells in peripheral blood were detected before anesthesia and at 2, 12, 24, and 48 hours after surgery. Results: There was no significant difference in the VAS scores between the two groups at 2, 24, and 48 hours after surgery (P > 0.05). The VAS scores at 12 hours after surgery in group DE were significantly lower than those in group SF with a statistically significant difference (P < 0.05). The percentage of Th1 cells in group DE at 2, 12, 24, and 48 hours after surgery was significantly lower than that in group SF (P < 0.05). The percentage of Th2 cells in group DE at 2, 12, 24, and 48 hours after surgery was significantly lower than that in group SF (P < 0.05). The Th1/Th2 ratio at 2, 12, 24, and 48 hours after surgery was significantly higher in group DE than that in group SF (P < 0.05). Conclusion: Dezocine for anesthesia induction and postoperative analgesia can maintain the balance of Th1/Th2 more stable than, with the same analgesia efficacy as, sufentanil during the early postoperative period in breast cancer patients undergoing surgery.