• Highly flexible, durable thiourea-functionalized covalent organic frameworks were synthesized in a single step. • The COFs synthesized at different temperatures exhibited different keto–enol tautomerism equilibria. • The high population density of the ordered pore wall functional groups empowers ultrahigh mercury adsorption capacity. • The synthesized COFs could efficiently remove Hg 2+ even from a 3-M HCl solution with a remarkably high K d value. • Hg 2+ adsorption promoted the keto and thiol tautomeric forms over their corresponding enol and thione forms. Covalent organic frameworks (COFs) have gained significant interest because of their exceptional performance in wastewater remediation. However, most COF adsorbents are synthesized using symmetrical rigid aromatic linkers, which limit the COF molecular design. Herein, we introduced a highly desirable thiourea moiety into a flexible crystalline framework through the condensation of the aliphatic thiocarbohydrazide linker with 1,3,5-triformylphloroglucinol knot. The synthesized flexible thiourea-based COFs, TpTch-90 and TpTch-120, existed in both keto and enol tautomeric forms simultaneously. Adsorption mechanism studies demonstrated that mercury adsorption favored keto and thiol tautomeric forms over their respective enol and thione tautomeric forms. TpTch-120 showed higher adsorption kinetics as it exhibited a high keto form as compared with that of TpTch-90. However, both TpTch-90 and TpTch-120 COFs possessed very high Hg 2+ adsorption capacity (4270 and 4277 mg/g) owing to abundant available chelating sites and their adsorption isotherms were fitted well by the Langmuir model. Both COFs were stable under harsh conditions and showed high removal efficiencies (>97%) under strongly acidic conditions (1–3 M HCl). Moreover, TpTch-90 and TpTch-120 adsorbed Hg 2+ selectively in the existence of competing metal ions attributable to the presence of soft–soft interaction between sulfur in COFs and mercury ions.