Which vacuum line? If you have large vacuum line unhooked, say brake booster for an example, and hook it back up quickly, the idle air control valve may not be able to react quick enough to keep it running. Will it idle if you start the engine with the vacuum line hooked up? If not, you may have a bad or stuck IAC valve. It's really just a computer controlled vacuum leak.....
Johnny