The events of the film are not exactly chronological. The subplot of the soldiers (called "the Mole") takes place over the course of a week, whereas the subplot of the people on the boat (I think it's called "The Sea") happens in a day.
Thus, this soldier hasn't suddenly jumped from one boat to another, there's at least the amount of time from the previous night to the next day's afternoon for him to have gotten aboard another ship, and for that ship to be sunk. There might even be 2-4 days between the two events. Soldiers were being evacuated from Dunkirk the whole week, there could have been a half dozen or more ships we never saw in the film carrying troops off the beach.
Note also that the English channel can be crossed twice in a day (you can almost see 'home' from Dunkirk). So no matter where in it you are, you're only a few hours from shore.