Other than during the reign of Maria Theresa, was there ever any serious risk of the line of Habsburg emperors being interrupted by a non-Habsburg being elected?

by MooseFlyer
Aethelric

The most serious other challenge in my purview was in 1619 is quite important in the Holy Roman Empire's history and in fact in Europe's history, despite the fact that the actual tally recorded no votes against the Habsburgs. This importance owes itself to the Thirty Years War, which began almost immediately after this failed challenge.

Some backdrop: at the start of the 17th century, Protestantism had spread widely throughout the Holy Roman Empire (HRE). Of the seven Prince-Electors able to choose the next Emperor, three were Protestant: Saxony, Brandenberg, and the Palatine. Three of the others were archbishoprics controlled by Catholic prelates, which left only Bohemia as a secular vote in the hands of the Catholics—and the Bohemian nobility, in a bit of a matroyshka doll, elected their own King. The leader of the Austrian Habsburgs had been readily elected in succession since 1526, in one of the Habsburgs' several "happy" conquests by marriage.

However, the Bohemian nobility was dominated by non-Catholics, with an admixture of Lutherans, Calvinists, and particularly Utraquists (Hussite). When preceding Emperor and Bohemian King Matthias died in 1619, the Bohemian were disinclined to accept his heir, Ferdinand II, despite having already voted for him ahead of Matthias' death in 1617, because Ferdinand II had undertaken successful re-Catholicization campaigns of his own lands in Austria and was poised to do the same in Bohemia.

This led the Bohemian nobility to seek an alternate, Protestant successor for their crown. They first offered the crown to the Duke of Saxony, who kept to his preexisting alliance with the Habsburgs and declined the offer. The next prince of note was the young and ardently Calvinist Count Palatine Frederick V, who foresaw himself taking a major role in the final defeat of Catholicism both in the HRE and abroad. He accepted the crown, despite the immediate threat of war with the much more powerful Habsburgs.

This theoretically placed the Electorship in the hands of the Protestants, but two things happened: one, the vote happened well before Frederick could have possibly received the news and attempted to use a second vote as King of Bohemia, but additionally both Saxony and Brandenberg voted in favor of Ferdinand II which made it numerically impossible for Frederick to become Emperor. The Habsburgs, along with every power of note, rejected the notion that a new King had been chosen in Bohemia, and moved immediately for war to remove the pretender.

Frederick V and his forces were quite quickly defeated in Bohemia, at the legendary (in Czech history) Battle of White Mountain, and Frederick was forced first to flee Bohemia to return home to that Palatinate and then to flee home for the Netherlands; his one-year term in Bohemia quickly earned him the mocking sobriquet "the Winter King". His co-religionists in the HRE largely remained removed from the conflict, preferring to avoid military conflict with the Habsburgs if possible; Frederick's father-in-law, King James I of England, was also disinclined to provide aid (considering the matter very foolish and brash) until the matter in Bohemia itself was largely solved, but just in time to help widen the conflict in a thirty year long conflagration that would see Germany depopulated by a full third.

My main source for this has been Peter Wilson's Europe's Tragedy: The Thirty Years War, which always carries my sincere recommendation as a huge, comprehensive text covering the entire conflict from first rumblings to the immediate effects of the final peace treaty at Westphalia. Thanks to /u/Reichsherold for correcting my incorrect statement about the vote total.