I can't find a link to an article from the 90's90s, but there was an article where a Bonanza pilot died in flight (healthdue to health issues), his plane came smoothly down in a field somewhere due to the autopilot keeping the wings level after it ran out of gas.
So as long as the plane has electric power, many autopilots will function when the engine stops.