My 97 16v did something similar to this at idle and had a flat spot at about 2000-4000 rpms when driven.
I went through everything you have done too with no result

plus new leads, coil, battery etc
Sussed it by replacing the #30 ECU relay with a new one.
And a mate recommended i fit a new crank angle sensor too....now done
Hope it helps
