I owned a 86 GTV6 which had some driveability problems kinda like this, similar. Was frustrating. Turned out the car had two problems.
One was that a main ground for the engine, to the firewall I think, was not tight and would get hot after a while and evidently start to build resistance, affecting how the engine ran, rough, and perhaps quitting, not restarting. Cleaned and tightened, that fixed that problem.
The other, at another later time, was the multiconnector to the AFM being very dirty, and after the engine and bay warmed up, would start acting up, sometimes not conducting properly on one or more of it's connections, engine running rough and sometimes quitting. Cleaning with electronic spray and using dielectric grease solved that problem.
Car ran like a dream after fixing those two poor/dirty connections.
In a sense, it was a similar problem, dirty electrical connections, with my 94LS, where the ignition modules under the air filter box were dirty and sometimes would not conduct on several cylinders, engine running rough and sometimes quitting after a while. Cleaning those multiconnectors and using dielectric grease cured that problem.
Alfa did reimburse Alfa mechanics on warranty for cleaning and using dielectric grease on engine bay electrical connections in many of these cars, including the 164s, to solve persistent driveabililty problems. Not saying the above are your problems with the car, and you may have already checked them, but checking and cleaning those cured similar problems with my GTV6, so thought I would offer them.
89 Milano (wife's daily driver since 1989, Shankle Sport)
91 164S (my daily driver since 1994)
94 164LS (~Q) (trip Alfa since 2000)
72 Morgan 27 (water time since 1976)
previously owned since 1964:
62 Morris MiniMinor 850, 67 Austin 1275 Cooper S (Downton 3/4 race), 64 Giulia Sprint GT (1st red one made), 72 Fiat 128 Sedan, 75 Alfetta Sedan, 78 Alfetta Sedan, 78 GTV, 81 GTV6, 86 GTV6
Last edited by Del; 03-21-2017 at 10:34 AM.