It is Oct. 17, 1966, and Vinny Dunn, a 31-year-old lieutenant in the Fire Department, is sprinting east on 23rd Street to get his orders on working the rear of a burning building on East 22nd.

He reaches a chief who orders him and his engine company into an adjacent building. Then the chief turns and orders another young lieutenant, Joseph Priore, to have his company pull a hose line into the Wonder Drug store on 23rd Street, which backed up to the burning building. Lieutenant Priore and the men of Engine 18 disappear inside, never to be seen alive again. They were lost in a floor collapse, which killed 12 firefighters, including the commander who ordered the men in, Deputy Chief Thomas A. Reilly.

Among them, the dead men left 12 widows and 32 children. It took 14 hours to dig out the dead. Until Sept. 11, 2001, it was the heaviest loss of life in the Fire Department's history. A lengthy inquiry showed that a cellar wall had been moved, leaving the drugstore's five-inch-thick terrazzo floor unsupported and vulnerable to collapse.

Today, the department will remember the dead in a ceremony at noon at East 23rd Street and Broadway.

Vincent J. Dunn, a smart and talkative man who rose through the department's ranks to deputy chief, has spent the intervening years learning all he could about load-bearing walls and joists, about how buildings work and why they fail.

What he has learned he has summed up in two sentences in his book, "Safety and Survival on the Fireground" (Fire Engineering, 1992): "There are no new lessons to be learned from a firefighter's death or injury. The cause of a tragedy is usually an old lesson we have not learned or have forgotten along the way."

To some extent, Mr. Dunn and others say, the Fire Department faces the same problems it did in 1966. An anniversary not only recalls the dead, but also reminds the living of hard lessons that come from collapses and illegal construction like those that killed firefighters in 1998 and 2005.

To keep those lessons fresh, Mr. Dunn has written magazine articles and books. A decade before 9/11, he wrote an article warning that it was only a matter of time before a fire in a skyscraper led to a catastrophic loss of life.

Now 71 and retired, he lectures across the nation, and he served as an adviser to the National Institute of Standards and Technology on the fire and collapse of the World Trade Center.

Still, he has been unable to answer the bigger questions at the heart of his life's work. Why had Chief Reilly turned to him first? What if he, not his friend Joe Priore, had been sent inside 6 East 23rd Street?

"Had he reversed those orders, we would have been dead," Mr. Dunn said last week in the sun room of his home in Douglaston, Queens. "For some reason. ..." he began. He left the thought unfinished.

His is costly wisdom, gleaned from seeing firefighters killed and injured in buildings that have been improperly built and renovated, even after the 23rd Street fire, when the city vowed to protect its firefighters better by improving the information given to them about renovations, among other things.

Firefighters periodically inspect buildings near their firehouses, and the information they collect is entered into a database. They cannot enter private dwellings, though, and often illegal construction goes unnoticed.

If a glance at recent fatalities is any indication, firefighters sometimes lack an accurate picture of the building they are entering. In 1998, Capt. Scott LaPiedra and Lt. James W. Blackmore died after being trapped under a falling floor in a Brooklyn building where a bearing wall had been improperly moved, leaving the few remaining supports to burn quickly. Three other firefighters were injured, and the city, which owned the building, ultimately paid millions in settlements.

In January 2005, illegal partitions in a burning Bronx apartment cut off access to a fire escape, forcing four firefighters trapped inside to jump from a window. Two, Lt. Curtis W. Meyran and Firefighter John G. Bellew, died. The building owners and tenants were later charged with the deaths.

In August, Lt. Howard J. Carpluk Jr. and Firefighter Michael C. Reilly were killed after a floor collapsed in a Bronx building that a fire official said is being investigated for improper construction.

"Unless you stop going into buildings, it's going to keep happening," said William J. McLaughlin, a lawyer and former New York City firefighter.

Though the investigation into the cause of the August fire is not complete, it seems, in some aspects, similar to the 1966 disaster.

In that fire 40 years ago, a fire was reported just after 9:30 p.m. in a building at 7 East 22nd Street, near Broadway, where an art dealer stored highly flammable lacquer and other paint supplies in the cellar, according to the Fire Department's report.

The smoke was so thick and the heat so intense that the first firefighters to arrive had difficulty entering the building. Fire officers sent crews around the corner to 23rd Street to see if they could enter through the drugstore.

What fire crews did not know was that the East 22nd Street building shared a cellar with the Wonder Drug store. And in a recent renovation, the dividing cellar wall had been pushed north toward 23rd Street, giving the art dealer more storage space and shrinking the cellar under the drugstore. The art dealer's supplies were now stored beneath the drugstore.

Only a small amount of smoke was wafting out of the drugstore when firefighters went inside. But around 10:40 p.m., as they walked to the back of the store, the floor collapsed with a huge noise, sending 10 firefighters to the burning cellar below. Two others were killed in a flashover of fire on the first floor.

Manny Fernandez, then the driver for Engine 18, had stayed outside the building, following protocol. After the collapse, he tried crawling inside on his hands and knees, he said, but the heat was too much.

Now 75, retired and living in Jackson Heights, Queens, Mr. Fernandez still weeps when he recalls the dead.

Forty years after losing her husband, Marie Reilly, 84, said she could remember it all as if it were yesterday and still struggles to make sense of it: "It's just one of those things. Who knows." She never remarried.

Of the 32 children left behind, only one went on to become a New York City firefighter: Joe Finley, the son of Black Jack Finley, as the Ladder 7 lieutenant was known. A grandson of Lieutenant Finley, Brian, is now a firefighter in Ladder 7 on East 29th Street, and every day when he comes to work, he passes a bronze plaque with his grandfather's name hanging just outside the front door.