here (one of the co-authors is an old professor of mine!), it sounds like you could shift the orbit of the Earth by about 30 miles by sending a massive asteroid on a close pass. They're thinking more about the very long term, shifting Earth out to the orbit of Mars as the Sun heats up later in its lifetime, and for that, it sounds like it could work well, sending an asteroid flying by every few thousand years over a very long time period. But for the kind of emergency move we need in this scenario, you'd still need at least a few hundred passes (just how far away does the Earth need to be from a Mars-sized impactor before the tidal forces from a near miss aren't just as effective in destroying life as a direct hit would be?), which might be hard to orchestrate in the very short time frame available. I also tried to do some order of magnitude calculations on building mass drivers to start launching rocks at high speed to shift the Earth's orbit, and again it appears to fall well short of what you'd need.
Conserve energy. Commute with the Hamiltonian.
There may be an interesting alternative, though. There's a Moon-sized thing available which is much less massive than the Mars-sized thing. It might be easier to nudge it so that it gets in the way of the Mars-sized thing. This will still involve a stupendously violent shower of impactors that bombard Earth...and over a long term, also, as most of the ejecta ends up in a huge torus of NEAs around 1AU from the Sun.
But this reduces the problem from space habitats to mineshafts...
We could save so much more if we decide to stick in solar system compared to trying to get to another star.