Walter, with no plan and facing his inevitable death, is sitting by his pool waiting for his assassins. He keeps spinning his gun, which points at himself over and over to signify his death. But then, the gun points to his Lily of the Valley. Walter being a master chemist concocts his daring scheme, a way to save his life. The plan is to remove the ricin cigarette from Jesse (hiring Saul, who got his goon to do it) and poison Brock with the plant. Walter assumes that Jesse will immediately think Gus did it, given Gus's history with using children to achieve his goals.
But as usual Walter underestimates those around him and doesn't realize just how far the wedge between him and Jesse has come. When Jesse starts pointing his gun at him Walter is legitimately surprised, but uses his "Tell me what I did to you so I can twist it around in my favour" technique to make Jesse "realize" it was Gus who did it. At this point Walter knows he's probably dead either way, so plays into Jesse's reluctance to murder in a last minute hope to save his life, and his gamble pays off.
They team up to take down Gus, their first plan being to force Gus to visit Jesse in the hospital so they can use a car bomb to kill him. Gus is legitimately concerned (as much as he is capable of, anyway) with Jesse's plight; when he hears that Brock was poisoned and not just sick the cogs in his head start turning. Who would do such a thing? Walter. So he doesn't get in his car, for he senses danger.
And then the events of Face Off play out, and it is revealed Walter has finally managed to outmaneuver Gus. "I won."