I think the keyboard is faulty. You are not the first with strange system behavior with a faulty keyboard. Usually all problems are solved when the keyboard is replaced.
What I don't get is why Microsoft just didn't make a simple keyboard instead of this over complication (probably due to the Touch Cover), but anyway.
My guess is that when you had the keyboard in, you allowed the System Firmware delivered in Windows Update to update the keyboard firmware, and fixed your problem. But my guess is that the firmware chip you have in the keyboard is faulty, hence why it didn't work the first time. I suspect it could potentially lead to further issues down the road with newer firmwares. If you can return it and order a new one, I would... better be safe. Hopefully, your Surface Pro 2 is not faulty.