Question: I'm going to a concert to Vienna on Saturday (two days). I just realized that there aren't any trains back to my home in the night so I'd have to wait til the morning until the first train leaves again (5.43 AM).

I don't know when the concert will end, but expect it to be somewhere between midnight and 2 AM. 

Now, I don't want to spend 40 € on a hotel room, especially when I can only "book in" in the middle in the night and have to leave really early. 

Is there any safe space in Vienna for a young woman to stay for a couple of hours in the middle of the night? I don't need to sleep, I just don't want to get raped. 
Are train stations safe there? Or are there any cafés which are open 24/7? MacDonalds?

Answer: 
For 5.8€, you could get a transit day pass that allows for unlimited travel on the transit network, including night buses – (especially) if you take a seat next to the bus operator, you'll definitely be safe, and you'll also see some more of Vienna.
If your main concern is that you have to pay for a hotel room for the entire day but would spend only a couple of hours in it, maybe you could opt to leave Vienna later in the day or early evening instead of early morning. 

That way you can relax after a possibly tiresome concert, wake up fresh, then either spend time in the room or explore Vienna a bit (if you haven't already) and then take a train to your final destination later in the day. I feel this option would be safer than opting to stay out in the open (even if its in a 24-hour McDonalds). You could cut your cost by some euros by staying in a dorm instead of a hotel room.