A pre-dawn blaze ravaged an apartment building in Herndon yesterday, leaving nearly 50 residents homeless and causing more than $500,000 in damage, Fairfax County fire officials said.

Groggy residents from 16 apartments, awakened by a neighbor who spotted the flames and began banging on doors, raced from the three-story building minutes before the fiery roof collapsed into the top floor units at 541 Florida Ave., part of the sprawling Jefferson Mews complex in southwest Herndon. There were no injuries, fire officials said.

"If we had been there a split second longer, we wouldn't have made it out," said resident manager Denise Fletcher, whose apartment was destroyed.

Fletcher's husband, Jeff, along with other residents, spent most of yesterday poking through the charred remains of their possessions, most of which firemen had tossed out the windows into black, smoldering heaps on the muddy ground.

"When I heard the knock on the door, I grabbed my purse and my parakeet and ran out," said Judy Sauls, who will live with relatives until she can move back into the building.

About 50 firefighters using 18 fire units battled the blaze for almost an hour as pajama-clad residents stood in the chill night air "watching everything we owned going up in smoke," said Ruth Graves, who had lived in the building for the past four years.

Fire marshals said last night they still had not determined the cause of the fire, but were investigating the possibility that the blaze may have been connected to another fire in the same apartment about six hours earlier.

Firefighters had been summoned to a third floor apartment at about 11 p.m. Saturday to extinguish a grease fire.

The apartment occupant told them he had been cooking french fries in a pot of grease and had gone into the living room to watch a basketball game.

Falling asleep, he said he was awakened by his smoke detector and saw flames leaping from the pot and climbing up the cabinets into the ceiling.

Fire marshals said it was "very possible" the second fire was started by smoldering sparks in the walls or ceiling materials that were not detected in the first blaze.

The second fire was discovered by two young men walking near the apartments who saw the flames and sounded the fire alarm, but apartment residents hailed neighbor Alton Wood, an off-duty county fire department employe, as the hero of the day.

"If he hadn't banged on the door," said Diane Fletcher, "Jeff and I wouldn't have even woken up."

Wood, who heard the fire alarm and saw the smoke, called the fire department and then ran from door to door yelling an alert.

"This was a switch for me," said Wood, who works in the communications section of the fire department. "I'm usually the one that takes the fire calls."

As Wood stepped out of the charred building yesterday afternoon carting a brown bag filled with his own possessions, his neighbors stopped their cleanup efforts momentarily and began clapping and cheering: "Yea, the hero! The hero!"

Nine of the apartments were severely damaged by fire and water, while nine others were condemned because of damage to the units' electrical wiring.

Two of the apartments had been unoccupied, apartment officials said.

Red Cross volunteers set up an emergency center in the Jefferson Mews club house, dispensing blankets, cots, coats and pizza to the fire victims.

All but six of the homeless families will be housed temporarily in vacant apartments at the 18-building Jefferson Mews complex or with friends or relatives, said Arthur J. Gregg, coordinator of the Red Cross operation.

Gregg said the Red Cross has had "more than enough families" who volunteered to take in the six families who had no place to go.

While many of the families were loading their belongings into pickup trucks and vans, others, including Jeff Fletcher, continued to sift through the rubble, trying to beat scavangers to their few remaining possessions. Fletcher and his wife were especially hoping to find his bronzed baby shoes and her wedding gown, both items of sentimental value.

Shortly after noon, Fletcher pulled a dusty blue box from beneath the mounds of ashes.

"My watch," he exclaimed, pulling it from the box and holding it to his ear. "And just like the ad says, it took a lickin' and kept on tickin.' "