I have had a few of these rough idle/misfire sound cases with the BMW 540i e34 models as well (Even my own). In my cases, It turned out to be the manifold cover on the back of the intake manifold. There is a valve inside this cover made out of a kind of plastic rubber material and it tends to fall apart or get torn with age. This usually occurs around the 100,000 km mark on these models but can also be earlier. If you remove the Idle Control Valve and notice some liquid engine oil sitting in the intake manifold, especially behind the valve grommet, then the manifold cover is allowing engine oil to be sucked into the intake thus the faulty manifold cover. Some auto part stores such as Autohaus Arizona online call it an EGR emissions valve. It is BMW part number: 11617501563 for e39 models. This will also cause more exhaust smoke than usual in most cases but will cause the rough idle and misfire feel that you are experiencing. And with this problem, no codes will show up when the engine is connected to the BMW diagnosis system. It is recommended that the intake manifold be removed for easier access, which will also mean changing the intake gaskets etc. And please make sure that you use a Genuine BMW manifold cover when replacing it as the aftermarket ones give premature problems as I have experienced (the last aftermarket one I installed fell apart at 10,000 miles) and we were back to where we started. Your car will drive and feel like new again when this problem is rectified. Hope this information helps you and best of luck with the BMW.