In a revelation received by Joseph Smith, dated 12 January 1838 and recorded on p. 17 of The Book of the Law of the Lord, we read the following:
Trial of the First Presidency.—
A Revelation given at the French Farm, Kirtland Geauga Co, Ohio. in the presence of Joseph Smith Jr, Sidney Rigdon, Vinson Knight and George W. Robinson. January 12th. 1838. When enquiry was made of the Lord relative to the trial of the First Presidency of the Church of Jesus Christ of Latter Day Saints, for transgression, according to the item of law found in the Book of Covenants 3rd. Section 37 verse, whether the decision of such a Council of one stake, shall be conclusive for Zion and her stakes.
Thus saith the Lord, let the first presidency of my Church, be held in full fellowship in Zion and in all her stakes, until they shall be found transgressors, by such a high council as is named in the above alluded section, in Zion by three witnesses standing against each member of said presidency, and these witnesses shall be of long and faithful standing, and such also as cannot be impeached by other witnesses, before such Council, and when a decision is had by such a Council in Zion it shall only be for Zion, it shall not answer for her stakes, but if such decision be acknowledged by the Council of her stakes, then it shall answer for her stakes, but if it is not acknowledged by the stakes then such stake may have the priviledge of learning for themselves, or if such decision be acknowledged by a majority of the stakes, then it shall answer for all her stakes. And again,
The presidency of my church may be tried by the voice of the whole body of the church in Zion, and the voice of a majority of all her stakes. And again.
Except a majority is had by the voice of the church of Zion, and a majority of all her stakes, the charges will be considered not sustained. And in order to sustain such charge or charges, before such church of Zion or her stakes such witnesses must be had as is named above, that is the witnesses to each president, who are of long and faithful standing, that cannot be impeached by other witnesses before the church of Zion, or her stakes, and all this saith the Lord because of wicked and aspiring men Let all your doings be in meekness and humility before me, even so Amen.
What this revelation clearly shows is that there was an internal process for removing the first presidency if they were in transgression; and it was to be done by the Church's elders and by common consent, not by supernatural means.
This (uncanonised, alas) revelation is important for a number of reasons:
Firstly, it explicitly shows us that there is an internal process for removing the First Presidency, but by supernatural revelation, but by the elders of the Church upon reaching a common consent (cf. D&C 102).
Secondly, it should put to rest the false interpretation of what it means that the Lord will not allow the president of the Church to lead the Church astray. It is not a claim the president of the Church will not teach doctrinal error (cf. Brigham Young teaching Adam-God; the temple/priesthood restriction, etc). Instead, it is that the Lord will now allow the president and the rest of the leadership of the Church to lead us into a full-blown apostasy from the truth.