BGE: How to make a Key inactive after pressing another Key?
You can use states: In the first state, you have a W keyboard sensor, linked to a motion actuator that moves the object forward, and you have an S keyboard sensor linked to a "Set State" actuator, which will set the second state.

On the second state, you have a W keyboard sensor, linked to a motion actuator that moves the object backward.

That should produce the desired behavior you described.

Here's a demo, if required: logic_brick_key_remap.blend