In this paper, we present a comprehensive framework for energy harvesting (EH) enabled adaptive mode selection policy for cognitive device-to-device (D2D) communication in a hybrid cellular network. We address two fundamental and interrelated questions: First, how the spectrum will be allocated, and second when a potential D2D user will switch to D2D mode. A D2D user opportunistically accesses the spectrum occupied by the cellular user. Next, we propose that if a potential D2D user has enough harvested energy from the ambient radio frequency (RF) sources, the distance from the potential D2D receiver is less than a predefined threshold, and the potential D2D receiver also has sufficient harvested energy, then a potential D2D user switches to D2D mode. We propose to share the status of the energy queue of all potential D2D users among themselves before communication starts as a peer discovery policy. The pair with the highest correlation coefficient will communicate in D2D mode. This will reduce the number of retransmissions and increase spectrum efficiency. We present a stochastic geometry-based analytical framework that allows a unified performance evaluation of the proposed adaptive mode selection policy. We derive the expressions for transmission probability, coverage probability, normalized average rate, and spatial network-throughput density for both EH-enabled D2D and cellular users. We analyze the effect of varying network parameters on the system performance. All the developed D2D framework, simulation results, and the outlined remarks are utilized to provide significant design insights and specifications for the deployment strategies of EH-enabled cognitive D2D wireless networks.