Jim Alexander, 24, the proprietor of a running footwear store in suburban Philadelphia, surged to the lead at the 22-mile marker in the third annual D.C. Marathon yesterday and then stayed in front to win in 2 hours 27 minutes 44 seconds, a record for the circuitous course that runs through the city's eight wards.

Alexander finished well ahead of last year's winner, Robert D. Hirst, 35, who came in second at 2:28:05, and Navy first class petty officer Randy Sharberg, 27, of New York, who finished third in 2:29:36 after leading for the first 21 miles.

Vera Thornhill, 17, a high school senior from Mount Airy, Md., was the first woman finisher in 3:10:55. Second was defending champion Carole Williams, 22, a student at George Washington University Law School, in 3:14:21. Patricia Howard, 30, of Burke was third in 3:17:02.

Ken Archer, 34, of Bowie, who was first among the wheelchair athletes last year, successfully defended his title, in 2:31:43, more than a half hour ahead of second-place Anthony Harris of Washington, who finished in 3:04:01.

D.C. Recreation Department officials said 850 of the more than 1,200 who registered competed in the 26-mile, 385-yard run on a wet, chilly morning.

"I definitely felt horrible the whole way," said a soaked Alexander, sipping from a jar of fruit juice in the recovery tent at the finish line on the Mall in front of the Museum of Natural History. "I was thinking of dropping out after 10 miles."

Alexander, who vied with Hirst, an investment officer for the International Finance Corp., for the second position during the first 18 miles of the race, was trailing Sharberg by as much as a half mile at the 12-mile point as the runners passed Catholic University.

But over the next eight miles, Sharberg gradually fell back, and before the 19-mile mark, Alexander had closed to within 100 yards. At mile 21 on Anacostia Drive under the approaches to the 11th Street Bridge, Alexander pulled abreast of the front runner. But Sharberg regained the lead almost immediately and stayed a stride ahead for the next mile until Alexander surged to a 10-yard lead at mile 22 on Howard Road SE at the exit from Anacostia Park. For the remainder of the race, Alexander's lead only lengthened.

"I'm a very good second-part runner," said Alexander, whose victory yesterday was his first in a marathon. "At 13 miles I was over two minutes behind him, but at 15 miles I was really gaining. At 19 miles, I knew I was going to catch him, and I caught him at 21 and tried to surge on him, but he surged with me."

Sharberg, who stepped out in front of the pack almost immediately and was at least a quarter mile in front as the runners crossed the Duke Ellington Bridge and turned on to Columbia Road NW, said his calf muscles "started locking up at about 15 miles, but I thought I could maintain the pace."

When he regained the lead after Alexander passed him the first time, Sharberg said, "I thought I could keep it. I could hear his footsteps in back of me. But he surged again, and that was kind of demoralizing."

As the runners crossed the 11th Street Bridge just past the 23rd mile marker, Sharberg was overtaken by Hirst. Will Albers, who won the first D.C. Marathon in 1981, had registered to run but withdrew.

Thornhill, who runs for her Frederick County high school girls track team, took the lead early and held it. She won the women's division of the Maryland Marathon in Baltimore two weeks ago.

"We started together, and that's all I saw of her," said Williams, the second-place finisher who also ran in last Monday's Boston Marathon.

The first competitor across the finish line yesterday was Archer, the wheelchair athlete, who was given a 10-minute head start. Although he trailed the leading runners at points during the race, Archer took advantage of several downhill slopes in Anacostia during the latter stages of the race to build his lead.

Despite the weather, knots of spectators gathered along the course, and they cheered the frontrunners as they made their way through Georgetown, Cleveland Park, Adams Morgan, Northeast Washington, Brookland, Far Northeast, Anacostia and Capitol Hill to the finish point on the Mall.

Some of the runners said they liked the rain because it kept them cool, but most did not.

"It was pretty miserable at about the 10-mile point when it was coming down in sheets," said Sharberg. "Your shoes get wet and instead of weighing six ounces, they feel like they weigh six pounds. For a while there was an ambulance up ahead of me, and I almost wanted to climb in and forget the whole thing."