A few clarifications - the S7 does not go to the Vienna Central Station (Hauptbahnhof) nor does it go to St. Stephan's (Stephansplatz).
The best way to get from the airport to Stephanzplatz is by using a pre-paid taxi which will cost 32 Euro each way. The taxi ride will take about 20-30 minutes. As you only have a few hours, I think that this would be a good investment as taking the train and then subway will easily be an hour. I use red-cab.
That said, if you want to take the S7, then you should get off the S7 at Landstrasse/Wien Mitte. From Landstrasse/Wien Mitte you will take the U3 subway line to Stephansplatz. You can use the S7 ticket also for the subway. It should also be clarified that there is no such thing as a roundtrip ticket in this situation. You could, however, buy a second ticket at the airport but have it unvalidated. You would then validate the ticket when you return to the airport. Again, I would recommend taking a taxi back to the airport to reduce stress and increase your time in the city.
As for what to do during these few hours in the center, as noted above, the central area is very compact. You can easily walk towards the Hofburg and then down to the canal (not actually the Danube). I really like this self-guided walking tour created by a popular English language website here in Vienna - http://www.viennawurstelstand.com/article/the-ultimate-self-guided-tour-of-viennas-old-city-cobblestones-and-secret-alleyways/. Just do it backwards.