Did it blow a fuse in the fuse box under the hood? I don't have a 97 diagram, but the 99 diagram for a 4.2 shows several different fuses that power the PCM circuits, but there is only one that feed the computer itself. Which fuse is blowing?
And it's obvious from your experimentation, you have moved the wiring around and temporarily fixed the problem. I would go over the engine wiring with a fine tooth comb and see if you can find any bare spots.