Determine which wire goes to which connection?
The audio signal is AC, so soldering the wires on either way should function.

However, the phase of the audio output will depend on the wiring orientation. One of those wires is ground, and the other is the signal. Depending on which way you solder them to the speaker, the speaker cone will either push out or pull in with the same input signal. If you wire it such that the right headphone speaker is pushing out while the left one is pulling in, it might sound wrong. It might also be inaudible. If you can, open up the working side of the headphones and see how they did it there.

If you simply melt the solder that's there, there will be little or no flux to clean any oxides off the metal surfaces, and you may end up with a 'cold' joint. It would be best to add fresh flux, or fresh solder that contains flux.

As far as joints go, this is about as easy as soldering rework can get. Test it before reassembling. Then if you have to reverse the orientation, it will be quite easy.