[2] In 1710, when the Duke of Queensberry was out of favour with the other Whig leaders, the magistrates of Edinburgh asserted their ancient right and ousted Cunningham from the professorship to make way for their own nominee.
He then left Scotland, and established himself at The Hague, where he lived on a pension granted him by the Duke of Queensberry, devoting himself to chess and the study of the classical authors and of civil law.
In 1711 he discovered from Thomas Johnson, a Scottish bookseller and publisher at The Hague, that Richard Bentley was the author of the criticism inflicted on his friend Jean Leclerc for his edition of the fragments of Menander.
In 1721 he published a malevolent Alexandri Cuninghamii Animadversiones in Richardi Bentleii Notas et Emendationes ad Q. Horatium Flaccum.
He also worked at his editions of Virgil and Phædrus, published at Edinburgh after his death, and projected books on the Pandects and the evidences of Christianity.