When a well-muscled Sylvester Stallone impersonator sporting combat fatigues, cartridge belt and fake automatic rifle lost his way delivering a "Rambo-gram" to a lawyer in Buffalo Monday, he sensibly dropped by the Erie County courthouse for directions.

In the ensuing panic, scores of city police and sheriff's deputies scrambled through the courthouse with their revolvers drawn, and one shot himself in the foot, before "Rambo," his mission completed, was jumped by an army of law enforcers.

Yesterday all Buffalo was still reeling from the incident. "I'm thinking about just hanging the whole 'Rambo-gram' thing up," said John Gowen, a purveyor of jocular telegrams who sent the hapless messenger.

"I'm walking out, and I see all these cops and what looked like 60 cop cars in front of the courthouse, and about 300 people outside watching," said Mark Stancapiano, 28, whose Rambo-grams for Gowen's company, Show Productions, are priced at $64.95. "It was like 'Dog Day Afternoon.' I got a feeling that it could be me they're looking for. And I'm parked right in front of the damn place.

"So I thought, well maybe I can get to my car, maybe I can't. I was gonna stash the gun in the bushes. But I decided simply to kind of walk to the car, with my gun all covered up in my shirt. But all of a sudden these cops cross the street, and then one of them says, 'FREEZE! MIAMI VICE!' At least I think that's what he said."

After persuading the authorities not to do anything rash, Stancapiano was taken to jail, charged with disorderly conduct and then released on his own recognizance. "He was just seconds away from being a statistic," said police Lt. Francis Lee.

Not so lucky was patrolman Gerald Baetzhold, he of the wounded foot.

"It still hurts like hell," Baetzhold, 45, a 21-year veteran of the police force, said from his hospital room. "We initially received a call of a man with an automatic weapon, and my .38 went off as I and other officers pursued him. It's my right foot, the right side. I'll be in here a week. After that, I don't know. It's up to the doctors."

Stancapiano wasn't inside the courthouse at the time of Baetzhold's mishap. He was across the street, at the office of James E. Rolls, John Gowen's lawyer and part owner of a Buffalo nightclub. Gowen, who manages a band that plays the club on Tuesday and Wednesday nights and weddings the rest of the time, sent "Rambo" to muscle Rolls into letting the band perform on Saturday instead.

"He always says, 'I can't let you have Saturday, that's our biggest night,' " said Gowen. "And I keep telling him I'll guarantee a full house. It just dawned on me that if somebody wants something, Rambo can go and get it."

Stancapiano, a Buffalo native who plays professional hockey in England and is doing 200 pushups a day to keep in shape during the off-season, said he has delivered about 20 Rambo-grams since he started them three weeks ago. They have ranged from an appearance at a "Stagette" party, where Rambo stripped down to a bikini bathing suit to dance for a future bride, to a raid on a local firm to negotiate a raise for a shy employe.

"I can look pretty fierce," he said.

Rolls said of his Rambo-gram, "I liked it." So much apparently that he's defending Stancapiano for free. "It was just a very interesting telegram that went haywire."