Not a Z4 owner (yet ?) but had similar problem with other half's VW.
Turned out to be a split hose to the manifold - which meant more air is sucked in, weakening the mixture and causing lean running.
Smoke test and diagnostic should be available at lots of indies. If a split hose is found (and leak does vary according to how much wellie, and thereby intake pressure varies) then It might be worth temporarily (just for the few minutes of the test) wrapping some tape around the split. If it cures the problem then the split hose is the issue. But you will need a new hose :roll: