Provided the bishops aren't heretics themselves. Then what happens?
It can't. The Church will persevere until the end of time and it will always be ruled by bishops:
OUR Lord, whose precepts and admonitions we ought to observe, describing the honour of a bishop and the order of His Church, speaks in the Gospel, and says to Peter: "I say unto thee, That thou art Peter, and upon this rock will I build my Church; and the gates of hell shall not prevail against it. And I will give unto thee the keys of the kingdom of heaven: and whatsoever thou shalt bind on earth shall be bound in heaven: and whatsoever thou shall loose on earth shall be loosed in heaven." Thence, through the changes of times and successions, the ordering of bishops and the plan of the Church flow onwards; so that the Church is founded upon the bishops, and every act of the Church is controlled by these same rulers. Since this, then, is founded on the divine law, I marvel that some, with daring temerity, have chosen to write to me as if they wrote in the name of the Church ... (St. Cyprian, Epistle 26)