That's pretty clever... only issue that I'd be concerned with is when you're replacing the dll while the server's running. It might be better to do some other scripting language. Though... I guess a simple try and catch would fix that problem.
As far as the thread goes... what is the data type that it should be returning (according to documentation)? You can always convert it by saying "as ____________". I'm not sure if you can do that with a byte array though (I've never tried - I've always done it with instance variables). You could also do a PInvoke and use the methods directly.