With a railpass you can also do the upgrade before getting on the train. In fact you can do that as the same time you make the coach reservation, although you will pay the current bucket price. Doing an onboard upgrade guarantees that you will pay the lowest bucket price for the room. However, there is of course the big risk that all rooms sell out before the train leaves the station, as well as the risk that you get a disinterested conductor who doesn't want to be bothered doing the paperwork for the upgrade.
So if you really, really want a room book it early. If you're willing to roll the dice and gamble to save money, then wait.