A bid to demolish a derelict Borders farm cottage thought to date back to the early 17th century has been rejected.