After a discussion on #winehackers I want to add something for the archives:
This is a situation that cannot be solved in d3d9 alone, a fix has to involve wined3d. This is because there is a hidden reference kept on every object that is referenced in any stateblock, even the non-primary ones. d3d9 does not know which objects are in which stateblock, so it cannot adjust the hidden references properly in the setters(if a stateblock is recorded) or in stateblock::capture.