Cops came within a hair’s breadth of nabbing “phony fireman” sex attack suspect Peter Braunstein yesterday after he bought a cup of coffee in a Brooklyn cafe – brazenly ignoring a police van parked outside.

Braunstein, 41, abruptly left without picking up his change when he was recognized by John Arena, the owner of Bococa’s Cafe on Court Street. The wanted man turned right – and vanished.

Arena, whose cafe is seven blocks from the home of Braunstein’s first wife, went outside, noticed the van and told the four cops inside what had happened.

But when the officers ran out to look for the suspect, he was gone.

The 7:30 a.m. sighting sparked a massive police response. Cops swept the area with bloodhounds and helicopters before bursting into a vacant brownstone on Henry Street – two blocks away – with a squad of heavily armored officers.

The team of Emergency Service Unit cops and detectives found no signs of anyone inside the building, which is under renovation and hasn’t been occupied in three years.

They also raided a carriage house – whose roof is falling in – behind the brownstone and found no one there.

Police sources strongly believe that the man spotted at the cafe is Braunstein.

“I knew right away,” said Arena, who is “99.9 percent” sure the man who ordered a large coffee with milk and sugar yesterday was the fugitive.

“We both gave each other the same vibe,” he said. “We looked at each other like, ‘You know who I am.’

“I looked at him like I saw a ghost. He caught on right away. He knew I knew who he was.”

Braunstein, who had forked over two $1 bills, picked up his coffee and strode briskly out of the cafe without waiting for his 60 cents in change, Arena said.

Arena said he knows what Braunstein looks like from seeing his picture in The Post alongside stories on the sex-crime suspect. The writer allegedly dressed as a fireman on Halloween and forced his way into the Chelsea home of a former co-worker, who was then molested for nearly 13 hours.

The shop owner said Braunstein was wearing a three-quarter-length trench coat and a yellow T-shirt or scarf.

“I read the paper every day, and watch the news every day, and from what I see and what I hear it’s [him],” Arena said. “His hair changed a little bit, it got a little longer, and he got a little heavier in the face.”

After Arena told the cops outside, they sprang into action.

“The response was immediate and massive,” he said. Police brought in bloodhounds to pick up any scent trail that the former writer may have left behind. Sources said officers gave the dogs a pillow case seized from the Queens home Braunstein shared with his mother – and they soon picked up his scent.

The dogs led a cavalcade of cops in a search out from the coffee shop. One of the dogs led officers to Henry Street, where the trail led up to the stoop of a building under renovation at the corner of Congress Street. Police eyed this location as a possible hideout for the suspect – a convicted criminal who is also wanted on a probation-violation warrant and who is believed to be desperate and dangerous.

Shortly after 1 p.m., a team of detectives and ESU officers, sporting helmets, body armor and large black shields, burst into the stately four-story brownstone. Shouts of “Police!” could be heard down the block.

But sources said that the NYPD team found no sign of Braunstein inside and no evidence that anyone had been staying in the vacant building for at least a year. Also, cops could find no one in the area who had seen a man resembling Braunstein.

Records show the searched building is owned by the namesake son of late New York concrete magnate John Quadrozzi. The elder Quadrozzi pleaded guilty in 1993 to paying bribes to Alphonse “Little Al” D’Arco, the former acting boss of the Luchese crime family.

Investigators believe that the dogs may have tracked the scent to that particular building because Braunstein at some point loitered there – or tried to break in.

“I find it very suspicious that the dog led us to a building that was abandoned,” one police source said.

The suspect’s whereabouts were not known last night, but police focused on the Cobble Hill area – warning business owners and plastering the neighborhood with wanted pictures.

Sources said cops have obtained videotapes from a camera posted on an engineering firm near the cafe, which is seven blocks from the home of Braunstein’s first wife, Donna Keane. The sighting of Braunstein sparked fear and vigilance across the tony brownstone neighborhood.

“All the firms around here have extra security, as a precaution against Peter Braunstein,” said Frank Hopkins, a guard at the Cobble Hill nursing home.

“It’s a huge concern,” added Robin Marshall. “If someone knocks on your door and identifies themselves as a police officer and law enforcement, it makes everyone a lot more cautious.”