If the Sun disappeared, how long would it take for the Earth to freeze beyond excavatable depths?
Step wise approach:

Right now when the surface is very cold, the frost depth here (Alberta, -40 min winter temps) can reach 8 feet.  Below about 30 feet seasonal temperature changes are under a degree.

Around depths of 100 feet temperatures start to rise, increasing about 25C/km or 1F/70 feet.

First approximation then for zero solar input (effective temp -270K) would be that you would need (270+20)/25 = ~12 km of depth to have roughly room temperature conditions.

We currently can't dig holes that deep.

The world's deepest is 3.9 km in South Africa.  Note that at 25C/km the temperature at that depth is well over boiling point.  Air is compressed at the surface, then chilled.  Air expansion in the working levels of the mine expands and cools further.

This assumes that the earth's insulation value is linear with depth.

Now:  Time: We can put a lower bound on it:

A year's temperature variation right now reaches 30 feet, with most of that being in a fraction of that.  So suppose that it penetrates at 30 feet per year.  I think this is too much, but it serves as a bound.  At 30 feet per year it would take 33 years per thousand feet, or about 110 years per kilometer. At present depts of 3.9 km, we have about 4 centuries.

In practice you wouldn't do it like this.  Go deep enough to get away from the worst, built an insulated cave, and run heat exchange tubing deeper to heat your cozy refuge until whoever borrowed the sun puts it back.