Cognitive deficit is common in patients with temporal lobe epilepsy (TLE). Here, we aimed to investigate the modular architecture of functional networks associated with distinct cognitive states in TLE patients together with the role of the thalamus in modular networks. Resting-state functional magnetic resonance imaging scans were acquired from 53 TLE patients and 37 matched healthy controls. All patients received the Montreal Cognitive Assessment test and accordingly were divided into TLE patients with normal cognition (TLE-CN, n = 35) and TLE patients with cognitive impairment (TLE-CI, n = 18) groups. The modular properties of functional networks were calculated and compared including global modularity Q, modular segregation index, intramodular connections, and intermodular connections. Thalamic subdivisions corresponding to the modular networks were generated by applying a 'winner-take-all' strategy before analyzing the modular properties (participation coefficient and within-module degree z-score) of each thalamic subdivision to assess the contribution of the thalamus to modular functional networks. Relationships between network properties and cognitive performance were then further explored. Both TLE-CN and TLE-CI patients showed lower global modularity, as well as lower modular segregation index values for the ventral attention network and the default mode network. However, different patterns of intramodular and intermodular connections existed for different cognitive states. In addition, both TLE-CN and TLE-CI patients exhibited anomalous modular properties of functional thalamic subdivisions, with TLE-CI patients presenting a broader range of abnormalities. Cognitive performance in TLE-CI patients was not related to the modular properties of functional network but rather to the modular properties of functional thalamic subdivisions. The thalamus plays a prominent role in modular networks and potentially represents a key neural mechanism underlying cognitive impairment in TLE.