I've travelled in Poland, Slovakia, Hungary, Romania and Bulgaria as a solo female traveler... and I survived !
There isn't much more risks taking the train there than in the "Western World". Even Romania, where I was told it was very
dangerous, that the Bucarest train station was so filled with pickpockets you had to watch your back all the time. And despite my spending hours in that train station a few hours, three times, even at night, nothing bad happened.
However, I did went through two moments where I felt unsafe, even once very scared, both on rural routes in Romania. Alcohol is sold on the black market in trains in Romania, so on less frequented routes, you might get stuck in alone in a compartment with drunk men, and that of course can become a problemt (in Romania and deeper Eastern Europe).
As for the night train, there is no problem in the sleeping car, and in the regular car, use a chain for your luggage.
In the train stations, yes there are pickpockets, there nothing you can do about it but to keep your valuables in a safe place. To reassure you, I've never met so far someone who was a victim of theirs.
Over all, during my six weeks there, in which I used the bus and train quite a lot, days and nights, it was very safe. Eastern Europe is great and worth seeing, and solo-female-traveler friendly ! If you go to the countryside, have a phrase book with you, because very few people can speak english.