After the Captain's meeting in Episode 24, Sosuke Aizen asks what Gin Ichmaru was planning and that he "wont get away with it" and to "not underestimate me". given the context at that point in the series it would put suspicion on Gin for being the grand mastermind behind the strange events concerning Rukia and her execution as what Aizen brought to Renji's attention previously.
But considering it was Aizen who was the mastermind this alters the context and that Aizen appeared to be threatening to punish Gin himself as if Gin encountering Ichigo and letting him live undermined Aizen's plans.
Also he knew very well that Ichigo was still alive because he waved them goodbye just as the gate shut and by letting him live would then risk Rukia's possible release before the Hohyoku was retrieved.
So what was Gin plotting when he encountered Ichigo at the Hakuto Gate?