In this study, we developed a temperature-resistant aptamer coupled with extended gate electric double-layer Field-Effect Transistors (FETs) for highly sensitive mercury ion detection. The design of the temperature-resistant aptamer is based on the thermal and structural properties of the hairpin structure. Two aptamer sequences were designed with different melting temperatures (Tm) and compared for their sensitivity. The hairpin structure of the aptamer with a high melting temperature ensures the stable structure prior to the addition of the mercury ions, which allows the formation of thymine–mercury–thymine (T -Hg2+-T) complex in low concentrations of mercury ions. High sensitivity and low detection limit are achieved at elevated temperatures with the aptamer having a high melting temperature. The elevated temperature facilitates the reaction rate, resulting in high sensitivity and a low detection limit. The aptamer with a high melting temperature hairpin structure has shown a remarkable improvement in the limit of detection with a 4 orders of magnitude increase compared to the one with a low melting temperature. The sensor with the high melting temperature aptamer shows an extremely low detection limit of 4.68 × 10−12 M, surpassing previously reported results. The aptamer with a low melting temperature requires mercury ions to stabilize the hairpin structure by forming a T-Hg2+-T complex. The results show that if the melting temperature is lower than the ambient temperature, it is very difficult to detect low concentrations of mercury ions at the ambient temperature. The selectivity of this sequence was also tested against multiple heavy metals, including arsenic (As), lead (Pb), chromium (Cr), and cadmium (Cd) ions. This study has shown how the structural and thermal properties of the aptamer, and the ambient temperature affect the sensitivity. They are strongly correlated to the performance of the sensors and need to be considered in the design of the sequence.