Hi Sharon,
We, too, purchased our tickets when we arrived at Rome's Termini train station for travel a few days later to Sorrento and had no problems.
We had a little confusion because we couldn't purchase a ticket all the way to Sorrento, only to Naples. The ticket agent explained that in Naples we had to switch trains to the Circumvesuviana (a local train). The train platform for the Circumvesuviana is downstairs from the main station (where you'll likely arrive), and there are ticket windows where you can purchase your ticket.
This took place in March 2007, so others who have been there more recently will know better than I if things have changed, but I just wanted to mention it to you in case you didn't already know.
Happy anniversary!