SAN FRANCISCO -- By the time Cleveland Gary was drop-kicking his way into the end zone, the Los Angeles Rams figured something strange and sweet was happening before their eyes.

Maybe it was that pass-lateral-shovel from fullback Buford McGee to Gary for the Rams' first touchdown that did it. Maybe it was that confusing amalgamation of defenses the Rams threw at San Francisco 49ers quarterback Joe Montana, making him look mortal at last.

Maybe it was the Candlestick Park wind and gray sheets of rain that seemed to comfort the Rams, not rattle them.

"We've had a tough season, but today was our day," McGee said. "We felt that from the beginning, and we deserved it."

Whatever it was, the Rams (4-7) ended the winning streak of the 49ers (10-1) at 18 games yesterday, 28-17.

"That's the way we played last year," center Doug Smith said with a broad smile, "and, unfortunately, it hasn't been the way things have gone very much this year.

"But we had that air of confidence, that belief that we were going to go ahead and do it. Jim [Everett, quarterback] just said, 'Hey, this is us, this is who we are, this is how we play football, and let's not forget it.' "

Rams coach John Robinson credited the Rams' dominating, 17-play, 10-minute, 27-second drive that ended with Gary's soccer-style, 1-yard touchdown run, his third touchdown of the day.

On that drive, the Rams started on their 10-yard line after a Vince Newsome interception of Montana, one of three against the 49ers quarterback. With 14:28 left to go and gamely protecting a 21-17 lead, the Rams had to score or else leave the game in the hands of Montana.

"We had to move it," Gary said. "Just took our time, and we did it."

Slowly, methodically, the Rams took it out of Montana's dangerous hands, and put it into Gary's, which are dangerous for many reasons.

And on the last play of the drive, on third-and-goal from the 49ers' 1-yard line, Gary, who had lost a fumble earlier, let the ball slip from his hands, kicked it along the ground once, then simply picked it up about 4 yards from the goal line and went in untouched to put the game away with 2:31 to play.

"When you see something like that, I guess you know things are going right," said McGee, who, in addition to his passing exploits, carried a season-high six times for 36 rough-and-tumble yards and a touchdown. McGee also mentioned a tipped pass to receiver Flipper Anderson on the drive as a sure sign.

After the Gary touchdown, cornerback Bobby Humphery intercepted Montana, and the Rams had pulled off their third consecutive regular-season victory here.

"We needed that," Robinson said. "It was a win that is very gratifying to us. Obviously, it makes it more gratifying to do it against a great football team. They're one of the great teams of all time."

But not when a constantly-changing, hard-to-pin-down Rams defense is holding Montana to 22-for-37 passing, for 235 mostly undramatic yards, and forcing six costly 49ers turnovers. Not when receiver Anderson is making sharp cuts on a mud track, slicing up the 49ers secondary for eight catches and 149 yards.

And not when a 49ers team that had allowed just one rushing touchdown all year and was the No. 1 team against the rush allows three running touchdowns and 111 rushing yards on 37 carries.

"We've beaten this team before," Gary said. "What would make us believe that somebody was invincible? They're a good football team, but we're not a bad football team ourselves."

What happened early was that the Rams, who have been losing ugly all season long, finally got the chance and the dreary climate to pull the 49ers down to their level.

The 49ers may have lapped the Rams in the standings, but the Rams proved yesterday that they are nobody's lap dog when it comes to rugby in the rain.

With the football bouncing over heads, through hands and generally away from the 49ers, the Rams found the sure grip and capitalized on the 49ers turnovers.