In fact, this was a major problem to both Einstein & Newton. According to Newtonian, Gravity is instantaneous. In such a case, the planets would immediately escape into outer space. But, this event strongly neglects SR because, the event would be so fast that Earth will be out of orbit before we all would see the last light from the vanished-away sun. This problem was resolved with GR.
In GR, these gravitational waves travel at the speed of light and hence, the solution to this question - We'd definitely see the last visible light from the sun and then, the Earth breaks its orbital path, moves on its own along a straight line until it interacts with any other massive body..!