I agree with Susan. If the Circumvesuviana is included in your pass then great but it's not necessary to book a ticket all the way to Pompei; in fact, it may actually take you to the wrong train station (there are two near Pompei)? The good news is Pompei Scavi and Herculaneum are quick walks from the Circumvesuviana train line (and the views of the bay and mountain are great). To switch lines you head downstairs in the station, you can buy cheap tickets (3-4EU) from the newsstand that is right at the top of the stairs. Be sure you get on the right train, there is one to Pompei and another to Pompei Scavi, you want the latter.
You may want to consider staying the night in Naples? You can get a fast train to Naples but let's assume you arrive mid-morning. Then you still have about 40min train ride to Pompei. If you stay 3-4 hours that means you'll have to have lunch at Pompeii and the choices are slim and expensive (it's not Disneyland, they don't really accommodate tourists). Then you get back on the train and it's 30 min back to Herculaneum. Herculaneum took me about 1.5 hours with the audio guide which again isn't cheap but without it you won't know what anything is. Herculaneum is in the middle of a town so getting food and finding toilets is easier there. If you stay in Naples you could add the Antiquities museum to your itinerary that is where they store all the small artifacts they found in both excavation sites. The only artifacts still at Pompei are urns behind gates and there is no interpretive signage.