When did it stop being widleu spoken and why was it able to survive as a living language for so long? Was it due to the isolation of Cornwall?
This map illustrates the traditional way of viewing the decline of the Cornish language. Dolly Pentreath (1692-1777), who lived near Penzance (see map) is typically regarded as the last fluent speaker of Cornish, but the history of the language did not stop there. There were certainly other survivors who spoke the language into the late 1700s and perhaps into the 1800s, and the language survived in relic form much longer with phrases and perhaps in even more complex forms. Enough of Cornwall's "Celtic" nature survived that Cornwall was one of six "nations" recognized by the Pan-Celtic Congress during the first decade of the twentieth century, joining Ireland, Scotland, Wales, the Isle of Man and Brittany in the north-west of France.
The languages of Scots Gaelic, Irish Gaelic (Gaeilge), Welsh, and Cornish were all "assaulted" by English from the east causing the languages to make their defiant stands in the far west. The Celtic languages of Scotland, Welsh, and Ireland survive although their homelands were greatly reduced by 1900 through a process of economic and cultural domination and by means of systematic attempts by English-speaking authorities to eliminate native languages in preference of English.
The situation in Cornwall is unique. First, because the Tamar River nearly bisects of peninsula in the far south west of Britain (in 936, King Athelstan declared the Tamar as the boundary the separated England from Cornwall), Cornwall is almost an island (a point that many have discussed). It is also exceedingly long. Before the Tamar was bridged at its broad southern exit into the English Channel, it was difficult to make it into Cornwall, but once there, it was a long trip to Lands End in the far west. That said, Cornwall is small when compared to Scotland, Ireland, and Wales: its population was limited (in the 1861 census, there were roughly 360k people living in Cornwall) and geography was not as expansive, so the linguistic encroachment of English was expedited.
So in answer to your question, Cornish survived because Cornwall is isolated and long. And while the death certificate for the Cornish language has been written several times, the language has yet to be counted out. There is a revival movement. Many may scorn the effort, but the Cornish language is picking up some wind in its sail and the number of speakers is steadily increasing, having received "protection under the European Charter for Regional or Minority Languages by the UK government in 2001" with limited funding (see the previous link).
The situation is made more complex when considering place names and oral tradition. O.J. Padel demonstrates that while the remote west is dominated by Cornish place names, eastern Cornwall is transitional and neighboring Devon (to the east) exhibits the near-obliteration of an earlier layer in preference of Anglo-Saxon terms. O.J. Padel, ‘Place-names and the Saxon conquest of Devon and Cornwall.’ in Nick Higham, ed., Britons in Anglo-Saxon England, 215-30. Woodbridge: Boydell Press, 2007.
While place names can be regarded as documentation from a linguistic past, this evidence demonstrates the survival of a core Cornish culture that has yet to yield to what it means to be English. My forthcoming book (which is delayed at the printer) The Folklore of Cornwall: The Oral Tradition of a Celtic Nation (2018???) seeks to demonstrate how the oral tradition of Cornwall persisted in unique, indigenous forms. In addition, this map from one of my more recent studies shows how migratory legends associated with the south western pixy/pisky exhibit distinct forms when the folklore of Cornwall and Devon are compared.
All this means that the language was assaulted, was dying, survived in limited form together with a unique cultural fingerprint, and is now enjoying something of a revival.
edit: the standard history of Cornwall is Philip Payton's Cornwall: A History. Fowey: Cornwall Editions, 2004.