Cruz doesn't necessarily need to "win". He only needs to do well enough to stop Trump from winning, and thus get a brokered convention. And it appears he's on track to do that.
After that, it's a matter of convincing the party that pissing off the Trump voters will hurt less than nominating Trump.