Fuel cells are widely deemed as a sustainable cogeneration technology that promises great decarbonization potential. However, economic operations of such sustainable energy systems are challenging because of the coupling between the heat and power generation, as well as the imbalance between the production and consumption. To this end, this paper proposes an economic day-ahead scheduling strategy for a sustainable cogeneration system, consisting of fuel cell, battery, thermal energy storage (TES), and heat pump. Based on the component models, a dynamic programming framework is formulated, in which the optimization objective is minimizing the accumulative fuel consumption and the constraints are derived from safety requirements. Optimization based on a typical 24-h load profile results in an hourly heat and power flow pattern to exhibit a highly coordinated and complementary operation scenario within the whole planning horizon. The benefits of energy storage are fully exploited and the energy-saving potential of each component is explored. It is revealed that the incorporation of TES into the sustainable energy systems brings about 3.5% overall efficiency improvement and healthier battery operations. The effects of TES capacity on the efficiency of the sustainable energy systems are also discussed.