I found an old thread by somebody with an S4 who managed to recover from the same situation.
I had to reflash stock but before even letting the tablet have the chance to attempt to boot (and consequently get stuck in a bootloop with the Samsung logo), I had to reset it and go into stock recovery. After that, just a case of wiping data and cache and then reflashing the stock firmware again! Took me a fair few hours and a few wrinkles too but managed to sort it out. What a nightmare!