Massachusetts forward Maxie Esho (1) takes the ball to his face after St. Bonaventure center Youssou Ndoye (35) blocked his shot during the second half of an NCAA college basketball game in St. Bonaventure, N.Y., Wednesday, Jan 29, 2014. St. Bonaventure won 78-65. (AP Photo/Nick LoVerde)

OLEAN, N.Y. (AP) — St. Bonaventure finally proved it could hold on to a lead in the second half.

Riding the wave of emotion generated by a raucous home crowd, and the momentum produced by a stifling defense, the Bonnies capped a scrappy performance with a stunning 78-65 upset of No. 21 Massachusetts 78-65 on Wednesday night.

“It’s a statement for our program,” Bonnies coach Mark Schmidt said. “I tell our guys all the time, if you want to get respect, then you go out and beat a team of the talent that UMass has. And that’s how you get respect.”

The Bonnies (13-8, 3-4 Atlantic 10) snapped a 24-game skid against ranked teams dating to a 57-56 win over No. 20 Temple on Jan. 15, 2000. And they overcame their own recent stretches of inconsistencies and heartaches.

There was the 13-point lead the Bonnies squandered in a 73-68 loss at UMass on Jan. 11. And then there was their last outing, an 83-81 loss at Duquesne on Saturday that was decided on Derrick Colter’s desperation 3-pointer at the buzzer.

“It was a great victory,” Schmidt said. “Being able to beat that team by 13 points coming off a tough game at Duquesne speaks volumes about the character of our players.”

The win was keyed by a workmanlike effort in which Charlon Kloof scored 14 points to lead a group of five players who scored in double digits. Marquise Simmons had nine rebounds. Youssou Ndoye scored 11 of his 12 points in the second half.

The crowd of 3,881 began yelling “Yes! Yes! Yes!” with 30 seconds left, and then stormed the court with 2 seconds remaining. The court had to be cleared for a moment before play resumed, and the fans charged back out once the final buzzer sounded.

“We proved that when we play 40 minutes that we could beat anybody,” Simmons said. “And we know we shouldn’t have lost at Duquesne, and we should’ve have won at UMass the first time.”

Trey Davis scored 18 points for the Minutemen (17-3, 4-2), who lost for the second time in three games. Star guard Chaz Williams was a non-factor. He finished with 11 points and fouled out with 1:39 remaining.

“We’ve got to just saddle up and play a little better,” UMass coach Derek Kellogg said. “I think everybody can see we’re not playing as well as we could be. But we’re going to right the ship.”

The Minutemen were unable to carry over the offensive surge they enjoyed in a 90-52 blowout of Fordham on Sunday.

After trading leads six times through the first half, and again in the opening minute of the second, the Bonnies, who are 9-1 at home, went ahead for good with 18:47 left.

That’s when Matt Wright hit a jumper from the top of the key to give St. Bonaventure a 28-27 lead.

The crowd began sensing the upset with 5:26 remaining when Dion Wright capped consecutive drives with baskets to cap an 11-3 run. The Minutemen seemed to have gained momentum on Raphiael Putney’s dunk that closed the gap to 53-51 with 8:46 left.

With St. Bonaventure up 55-54, Andell Cumberbatch helped turn the tide by banking in a 3-pointer with 1 second left on the shot clock with 7:20 remaining.

St. Bonaventure forced 17 turnovers and prevented the Minutemen from establishing their fast-tempo pace.

They were particularly proficient in keeping Williams in check with a swarming defense that prevented him from driving to the basket.

“Going into the game, he’s the known. That’s the guy you’ve got to stop,” Schmidt said of Williams. “And if you do, you have a chance.”

The Bonnies did more than that: They frustrated the diminutive point guard.

Williams lost his focus on consecutive positions 8 minutes into the second half.

Both times he lost the ball while attempting to drive the lane. The second time, Williams not only lost the ball, but also had the purple headband stripped off his head.

While Williams was busy complaining with the officials, Denzel Gregg was capping a fast break with a dunk at the other end to put St. Bonaventure up 45-38 with 12:35 remaining.

After a UMass turnover, Williams’ grew upset and was issued his fourth foul for hacking Ndoye, who hit both free throws.

Williams spent the next 6 minutes on the bench with a towel over his head.

“He did get a little frustrated,” Kellogg said. “When you knock his headband off, I think he gets a little frazzled.”

Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.