It could be the IACV, the thermo valve, or air in the coolant system. If you have eliminated those, you may want to start troubleshooting the electrical (broken/shorting wires). Also, check the vacuum lines.
My car had a lumpy idle and stalled when coming to a stop. Then the speedo would intermittently stop working. I checked all of the above, then replaced the engine wire harness. Expensive? Yes. However, I was never happy with the way the wiring ended up after my B18C swap so I finally had a good excuse to put in a new engine wire harness. Now she purs like a kitten. No stalls, no spaztic gauges, no loping idle. Wish I had done it sooner.