I've reproduced your garbage. The only thing I can think of is that your static cast is invalid. That seems really odd to me but it's the only thing I can think might be happening. It could be that op<< returns something other than ostringstream that is not castable to ostringstream...like a reference stream of some sort. In fact, when assigning the reference to a variable and looking at the type in a debugger, it looks weird for a ostringstream.
At any rate, there's no reason to be "terse". In fact, being terse is often quite annoying to other developers who have to read your code. If you want to be "terse", put you stream stuff in a function that returns a string and name it something useful.
Edit:
Actually, I think I may have a better answer. You're binding a non-const reference to a temporary and calling a function on it. A const reference is guaranteed to continue existing until the end of the 'statement' (forgetting the technical term right now but it's close). A non-const reference does not have this guarantee. Therefore I think you are eliciting undefined behavior when you call str() on this non-const reference because the compiler is free to delete the temporary it refers to.