One of the major capacity boosters for 5G networks is the deployment of ultra-dense heterogeneous networks (UDHNs). However, this deployment results in tremendous increase in the energy consumption of the network due to the large number of base stations (BSs) involved. In addition to enhanced capacity, 5G networks must also be energy efficient for it to be economically viable and environmentally friendly. Dynamic cell switching is a very common way of reducing the total energy consumption of the network but most of the proposed methods are computationally demanding which makes them unsuitable for application in ultra-dense network deployment with massive number of BSs. To tackle this problem, we propose a lightweight cell switching scheme also known as Threshold-based Hybrid cEll swItching Scheme (THESIS) for energy optimization in UDHNs. The developed approach combines the benefits of clustering and exhaustive search (ES) algorithm to produce a solution whose optimality is close to that of the ES (which is guaranteed to be optimal), but is computationally more efficient than ES and as such can be applied for cell switching in real networks even when their dimension is large. The performance evaluation shows that the THESIS produces a significant reduction in the energy consumption of the UDHN and is able to reduce the complexity of finding a near-optimal solution from exponential to polynomial complexity.