Cunningham stood as a Whig for
Stirlingshire at the
1708 British general election but there was a dispute among the parties and the sheriff, on the pretext that Cunningham had only lately acquired a freehold, made a double return. However the Whig majority in the House of Commons ensured that he was seated.as
Member of Parliament on 11 January 1709. He voted for the impeachment of
Dr Sacheverell, but made little impression in Parliament. He lost his supporters at Stirlingshire and at the
1710 British general election he lost the seat. However he was returned in the same election in a contest at his fall-back seat at
Stirling Burghs. He supported a Tory candidate in a disputed election and was listed among the ‘worthy patriots’ who exposed the mismanagements of the previous ministry, but otherwise sided with the Whigs for most of the Parliament. He voted on 17 January 1712 against the Tory motion to send the younger Robert Walpole to the Tower, and on 7 February against the Scottish toleration bill. He twice told against the bill restoring lay patronage in Scotland and was teller for three other bills affecting Scotland. He presented an address on the peace from Stirling Burgh in March but also voted against the ministry over the French commerce bill in June. In 1713 he became a burgess of Edinburgh and was returned again for Stirling Burghs. He supported the Hanoverian succession and in January 1714, was reported to be travelling around the west of Scotland with his uncle Colonel John Erskine promoting Hanoverian addresses. He was Commissioner justiciary for the Highlands from 1714 to 1716. He voted against the expulsion of Richard Steele in March and in May he voted with other Scottish Whigs in favour of extending the schism bill to cover Catholic education. He was a signatory to the proclamation of George I in Edinburgh, and presented a loyal address from Stirlingshire in October 1714. He was introduced at court by the Duke of Argyll. ==Death and legacy==