DAVIS, Calif. -- Stanford may have been the first to take the lead in Wednesday's non-conference game at La Rue Field, but it was UC Davis that possessed an advantage when it counted the most as the Aggies scored three runs in the seventh inning to come from behind and defeat the No. 17 Cardinal 5-4.

The win is the Aggies' second against Stanford in the past three head-to-head meetings; UC Davis also recorded a 2-1 victory when the Cardinal visited Davis last season.

"To play a midweek game against an opponent of this caliber, I am proud of this team to come from class, switch gears and execute," UC Davis head coach Karen Yoder said.

UC Davis is now 22-24 overall while Stanford fell to 32-17.

By scoring two runs in the first inning and another in the third, it was the Cardinal who jumped out to an early 3-0 lead.

In the bottom of the third, UC Davis' Jasmine Lee trimmed her team's deficit to a more manageable one-run margin when her hard-hit chopper split Stanford's middle infielders and rolled into center, scoring catcher JJ Wagoner and second baseman Chandler Wagner to make it a 3-2 game.

The score remained in Stanford's favor by a run until the top of the seventh when the Cardinal added another to extend its lead to 4-2 prior to the Aggies' final set of swings.

A leadoff single by Christina Guidry started UC Davis' seventh-inning effort. Guidry advanced to second when Stanford left-fielder Leah White crashed into the fence deep in foul territory after recording the first out of the inning. Guidry scored on the next play when her sister, Cat Guidry, drove a single through the middle of the diamond.

Christina Guidry was one of two Aggies to finish with two hits against Stanford starter Teagan Gerhart; the other was Lee who ended her day with a single to center that allowed Cat Guidry to advance to second.

Now leading the Big West Conference with 17 hit-by-pitches, none may have been more valuable to UC Davis' cause as the one Kelly Schulze recorded in the seventh that loaded the bases with two outs for Christa Castello.

On her first pitch of the at-bat, Castello ripped a single to left, easily scoring Cat Guidry to tie the game.

"I knew my teammates worked so hard to get on base before me, I did not want to leave them stranded. That would be the worst thing to do in that situation," Castello said.

"I just waited until I found the pitch I was looking for."

"I thought Christa did a tremendous job not only defensively, but also coming through at the plate in a key situation as a freshman," Yoder said.

On the same play of Castello's clutch hit, is was the baserunning prowess of Megan Guzman that secured UC Davis' victory. She wasted no time rounding third and sliding around Cardinal catcher Jessica Plaza, who tried her best to shield as much of the plate as possible, to compete the Aggies' comeback. Guzman entered the game to pinch run for Lee.

After Jessica Thweatt threw four solid innings, striking out one throughout her time in the circle, Justine Vela entered the game to pitch for the Aggies and continued where her teammate left off.

As was the case with Thweatt, Vela continued to frustrate Cardinal batters as the game progressed and allowed only one hit throughout her three innings of action to pick up her 14th win of the year.

"Heading into the seventh inning, the bench was calm and collected. We believed we could win the game; once you put one runner on base, then another, then a third, we continued to apply consistent pressure and prevailed. I am very proud of my players," Yoder said.

"This win gives us the confidence to end the season strong," Castello said. "Hopefully this momentum will carry through our next two series."