Robert MacIntyre hit one of the shots of the tournament as he birdied the 18th on his final round to set the clubhouse lead at the Scottish Open.