It's a tricky question.
Generally, we travel by vehicles.
Thus, "I came by car" , even though you are in the car.
For most public transport such as trains and buses, we do things on them.
That is - '
We read books on trains/planes'
In your question, the medium of transportation is a train and thus, it'd take on as a preposition.
She has been oversleeping on the train and missing her stops.
However, in is possible if you further describe the location in the train.
She has been oversleeping in the train
compartment and missing her stops.
ell.stackexchange.com/users/3187/Maulik V
In British English we travel/go by most vehicles (train, bus, car, plane)
but we sit, stand, read books, etc, on the train, bus or plane (but in the car)
[see Swan, Practical English Usage (2005.81)].
We would therefore normally (over)sleep on the train.
ell.stackexchange.com/users/11291/tunny
Thinking about aircraft, I fly on a large aircraft, in a small one.
The difference is whether I can stand up inside; equivalently, whether I walk aboard or seat myself from a standing position on the adjacent ground.
The same is applicable to boats.
Trains have room to stand up, so one is always on them, even when asleep.
These are the usages that feel right to me.
ell.stackexchange.com/users/11563/Ronald Davis
As long as you use "on" for a bus, train, plane to travel, it means in/into.
It doesn't necessarily mean its roof.
(Keep it in mind that you get on a bus, plane or train; similarly, when you are travelling, you are on it).
(Please see Macmillan or Oxford in this connection).
So the correct sentence is "She has been oversleeping on the train and missing her stops".
ell.stackexchange.com/users/9259/Khan
In addition to the other answers, as a native speaker (of American English), the preposition "on" in this context makes me think of travel, as in "on a journey".
If I was sleeping in a train car that was sitting on some land, rather than train tracks, for example, I would use "in".
I believe the reason is because it wouldn't be a vehicle in that case.
ell.stackexchange.com/users/8397/James
She has been oversleeping  on  the train and missing her stops.  She has been oversleeping  in  the train and missing her stops.   Which is the correct  preposition  in the sentences above?
She has been oversleeping on or in the train and missing her stops - which is the correct preposition?
ell.stackexchange.com
<word-choice><prepositions>
ell.stackexchange.com/questions/38186
ell.stackexchange.com/users/6314/user73963
The correct sentence is "She has been oversleeping on the train and missing her stops". The medium of transportation is a train so it takes  on  as a preposition. On' is the correct preposition as the medium of transport is a train.
On' is the correct preposition as the medium of transport is a train.