Issue found and solved, it was related to a decoding issue of the base64 data, with one character ('+') being mistakenly converted to space ' ', so the issue only occurred when that character was present.
Why it didn't occur when the debugger breakpoint was set or from local connection is unclear though... maybe some timing element stored there.