Dear Luis,
The Versailles performances are always extraordinary, with world class ensembles. I've been to a number of them, and never missed the last RERC to Paris.
It may be a brisk walk back to the station, but the memory of the Opera Royale, the Chapelle Royale, or any other venue there will last a lifetime.
At the intermission, take your flute of champagne or Perrier and look out the windows at the fountains sparkling in the dark just for you.
When you arrive at the station on the way to the Chateau, confirm the last train time with the station agent. When you return to the station, there is just one train leaving, so no confusion, it goes to Paris. And, if all else fails, there is a taxi rank or night bus.
Which performance are you seeing?
Have a great evening!
Barbara