In this paper, an intelligent stochastic model is recommended for the optimization of a hybrid system that encompasses wind energy sources, battery storage, combined heat and power generation, and thermal energy storage (Wind/Battery/CHP/TES), with the inclusion of electric and thermal storages through the cloud theory model. The framework aims to minimize the costs of planning, such as construction, maintenance, operation, and environmental pollution costs, to determine the best configuration of the resources and storage units to ensure efficient electricity and heat supply simultaneously. A novel meta-heuristic optimization algorithm named improved horse herd optimizer (IHHO) is applied to find the decision variables. Rosenbrock’s direct rotational technique is applied to the conventional horse herd optimizer (HHO) to improve the algorithm’s performance against premature convergence in the optimization due to the complexity of the problem, and its capability is evaluated with particle swarm optimization (PSO) and manta ray foraging optimization (MRFO) methods. Also, the cloud theory-based stochastic model is recommended for solving problems with uncertainties of system generation and demand. The obtained results are evaluated in three simulation scenarios including (1) Wind/Battery, (2) Wind/Battery/CHP, and (3) Wind/Battery/CHP/TES systems to implement the proposed methodology and evaluate its effectiveness. The results show that scenario 3 is the best configuration to meet electrical and thermal loads, with the lowest planning cost (12.98% less than scenario 1). Also, the superiority of the IHHO is proven with more accurate answers and higher convergence rates in contrast to the conventional HHO, PSO, and MRFO. Moreover, the results show that when considering the cloud theory-based stochastic model, the costs of annual planning are increased for scenarios 1 to 3 by 4.00%, 4.20%, and 3.96%, respectively, compared to the deterministic model.