The goal of this work is to build computational tools to aid decision making for the modelling and operations of integrated urban energy systems that actively interact with the future power grid. District heating and cooling networks incorporating heat recovery and large-scale thermal storage, such as the Stanford campus system, dramatically reduce energy waste and greenhouse gas emissions. They have historically played a small, but important role at a local level. Here we explore the potential for other co-benefits, including the provision of load following services to the electrical grid, carbon emissions reductions or demand charge management. We formulate and solve the problem of optimally scheduling daily operations for different energy assets under a demand-charge-based tariff, given available historical data. We also explore the interaction and interdependence of an electrified thermal energy network with actively managed power sources and sinks that concurrently draw from the same electrical distribution feeder. At Stanford University, large-scale electric vehicle charging, on-site photovoltaic generation and controllable building loads could each separately represent up to 5 MW, or 15% of the aggregate annual peak power consumption in the very near future. We co-optimize financial savings from peak power reductions and shifting consumption to lower price periods and assess the flexibility of both the different components and the integrated energy system as a whole. We find that thermal storage, especially complemented with electric vehicle charging, can play the role that is often proposed for electrochemical storage for demand charge management applications and quantitatively evaluate potential revenue generators for an integrated urban energy system. Although there is little value to smart charging strategies for low penetrations of electric vehicles, they are needed to avoid significant increases in costs once penetration reaches a certain threshold – in the Stanford case, 750-1,000 vehicles, or 25% of the vehicle commuter population.