The compactness of the urban built environment significantly affects land surface temperature (LST), especially during heat waves (HW). However, the mechanisms by which the configuration of key building patches in built environments of varying compactness drives LST are unclear. This study proposes a new research framework combining local climate zones (LCZ), spatial pattern type (SPT) and landscape index (LI) to reveal the impacts of key building patches on LST. Taking Shenyang as an example, we utilized the geographically weighted regression (GWR) method to reveal the non-stationary relationship between building patches with different compactness and LST during heat and non-heat waves, and an optimal parameters-based geographical detectors model (OPGDM) to explore the mechanisms by which the configuration of key building patches drives LST. The results show that HW enhances the spatially non-stationary effects of different types of building patches on LST. The configuration of key building patches in the open built environment drives LST more strongly than those in the compact built environment. The relationship between LIs and LST in key building patches exhibits diverse characteristics during heat and non-heat waves, so differentiated configuration optimization strategies are required for built environments of different compactness. The interactions of patch configurations also require emphasis, especially the patch complexity. The research findings help to formulate urban planning strategies from a climate adaptation and mitigation perspective to cope with the increasing frequency of extreme heat events.