There's an odd mathematical construct you can strive for, to survive as long as you need. The key is that heat death is not an event, but a slow predictable decline in energy.
If you can accurately measure how much usable energy you have (lif you have to err, err on the lower side), and you can spend energy proportionally to that amount, you end up with an exponential curve of dwindling energy, which mathematically never ends.
The tricky part is when you are dependent on processes which are not proportional like that. For example, we are currently very dependent on activities which rely on quantized behaviors, such as the emission of photons. Those events will have to be more and more rare as the energy levels decrease. You would also likely choose to concentrate your energy in a smaller and smaller portion of your space, in order to permit at least a small portion to be using such quantized energy. In fact, this has lead to two competing extremes as to how to accomplish this goal. There is the continuous process, where you try to keep a fluidly decreasing amount of energy usage, and the discrete approach, where you subtly collect energy for as long as needed to permit one quick burst of a finite length of energy. Presumably whatever the final solution will be will involve a cross between both of these approaches.
The hard part is knowledge of the heat death: you don't have it. There is no way for science to know that heat death will occur, as opposed to us discovering that our mathematical models which proved heat death will occur were wrong. Sure in our 359 years or so of modern science and thermodynamics, we're pretty sure that's the direction things go. We have another 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 years before galaxy sized black holes vanish, and I'm not even going to write out all the zeroes in the $10^{10^{56}}$ years before quantum tunneling might start poking holes that let us into other universes, by our theories. We have a long time to find out that we have an incomplete theory. The hard part will be not developing a survival scheme that assumes we've seen it all, and starts down the path of exponential decay to live forever like Nietzche's Last Man. We would need to continue to reach out and observe the dying universe, looking for hope. If we find it, we need to be about to harness it to build the best world we possibly can.
You can imagine how horrible it would be to find that there was a god like physical entity just outside our perception, nurturing us along, only for us to give up on ever joining them. More interestingly, the smaller the civilization gets (as heat death looms), the smaller such an entity could be and still be perceived as having godlike powers! When the universe is facing proton decay, and a civilization is trying to simply hold onto the tiny quantum blurs that keep it alive, imagine how powerful you or I would seem, happily collapsing trillions of waveforms every moment just to pick up a glass of water, nevermind the trillians of irreversable chemical reactions going on in our synapses to feel like we are thirsty.
Thus, the balance. The more energy spent exploring the world outside, the harder it is to maintain an eventual exponential decay to live forever, but if you squirrel yourself away in exponential decay, that's all she wrote. You have to strike the balance between the two.
Fascinating how life itself has a tendency to be able to balance the nuances of continue procreation for an astonishing number of generations, while never ignoring the world around it, constantly evolving based on new observations and discoveries (even if those discoveries are simply radiation breaking DNA strands). Perhaps it is life itself that will one day strike this balance. Imagine what life could do if it reached out into the quantum world, instead of being shackled to classical physics. Maybe the Gaia theorists are on to something.