+1 on North Berwick. It's a can't miss from an architecture and history perspective. Also +1 on Crail. It's a golfing roller coaster, especially if the wind is howling, which is likely.
As for walking on TOC, my sense is that it can vary greatly from day to day. I've done it twice, including just a few weeks ago (July 4), when I was 12th on the list upon arriving at about 6 AM to meet the Hundred Hole Hike crew. Brought my friend by around 7:45 AM (there were still fewer than 30 names on the list at that point, including those who'd already gone out) and the starter got us out together at 8:50 AM, which was a very lucky break from what I could gather.
St. Andrews gets busiest, though, starting in mid-July, so to avoid missing out (or an extremely long wait), I'd go with Bill's advice and arrive by 5 AM. There's daylight, so consider bringing something to read.