For restaurants, I recommend the Grill House (2 course menu for 10.95 from 5-7) or either of the Indian/Bangladeshi restaurants. For lunch, if you're looking for something light, I would recommend any of the coffee shops, really. One of my favorites is the Coffee Shop and Tea Room on Greyfriar's Garden.
Make sure while you're here you hit both of the beaches: East and West Sands. Both have spectacular views of the different parts of town, and are very different experiences. West Sands is right near the Old Course, and East Sands is up near the harbor and the pier. However, I wouldn't recommend them at night unless it's summer (because during the summer there really isn't a night - the sun sets at 10 now and rises about 4:30). Also head down Castle Sands near the Castle itself, especially if it's nighttime and you want to build a bonfire.
Recently my running partner Ashley and I discovered a path that runs along a stream, and goes by a few parks and playgrounds, and behind houses with amazing gardens if you enjoy that sort of thing. It's called Lade Braes Walk and starts on South Street and heads for miles parallel to Hepburn Gardens. It's a great way to see the real St. Andrews, with football games and owners walking their dogs and children on the swings. If you're not into touristy things, and are more of a nature person, I really recommend it.
If you're more adventurous, I recommend the Fife Coastal Path to Crail. Ashley and I hiked this last week instead of studying (or revising, as it's called). It's 15 miles from St. Andrews to Crail, and some parts can be a little rough, so bring real walking shoes and some sunscreen, and you'll get some terrific views of the coastline:

maybe some golf courses:

and even a creepy house in the woods:

And if you're lucky, you might see a naked man sunbathing. Sadly enough I don't have a picture of this. The picture in my mind is quite enough.
If you do this hike, you can take a bus back from Crail, or you can take the whole day (and I mean whole day) and hike there and back. We took the whole day and were a bit delirious at the end.
Churches are abound in St. Andrews, and unlike a lot of churches in Europe, you don't have to pay to see them (I probably should mention that donations are accepted). Holy Trinity on South Street is incredibly beautiful inside, and it's open to all before noon on weekdays. St. Salvator's Chapel, the University Chapel, is open from 9-5 on weekdays normally, and is an incredible sight as well.
St. Andrews is a beautiful town, full of people on the sunny days and full of history every day. There is so much to be appreciated, I just hope I appreciate it by now.