LAFAYETTE — Ryan Leonards had been struggling, but the Louisiana-Lafayette third baseman picked a good time to break out of his slump.

The junior snapped a 2-for-27 skid with two extra-base hits in his final two at-bats Friday, the last one breaking a tie and helping the Ragin’ Cajuns take an 8-6 victory over Texas State in the opener of their Sun Belt Conference weekend series.

Leonards had an RBI double as part of a three-run fifth inning that put the Cajuns (38-5, 17-2) in front 6-3. Then, after the Bobcats rallied to tie it, Leonards drilled a triple down the left-field line in the seventh to score Blake Trahan with the eventual game-winner.

“Against McNeese last week (an 8-0 Cajuns win), everybody in the ballpark saw that I was struggling,” Leonards said. “But at UTA this past weekend, I hit some hard. I just wanted to keep doing that. It was nice to do it in that situation.”

“You can get in a rut, but you can’t let that rut turn into a grave,” Cajuns coach Tony Robichaux said. “He had a bad string, but he stayed with it. And when you’re good at the right time, people forget about what you did before that.”

Leonards scored two batters after his triple on Caleb Adams’ third hit of the game for a two-run advantage, and that was enough for UL-Lafayette relievers Greg Milhorn (4-2) and Ryan Wilson. Milhorn, who gave up his first homer of the year to Bobcats left fielder Granger Studdard in the seventh that tied the score, got out of that inning, and Wilson retired six of the seven batters he faced in the final two frames for his second save.

“Everyone in the dugout’s got confidence in (Wilson),” Leonards said. “We know he’s going to get the job done.”

Texas State (23-19, 11-8) scored single runs in the second, third and fourth innings on Tanner Hill’s ground ball that scored Studdard in the second, Cameron Friess’ RBI single in the third and Tyler Pearson’s one-out homer in the fourth off UL-Lafayette starter Austin Robichaux.

Robichaux was making his first start in more than three weeks, because of tendinitis, after throwing two relief innings at UTA last Saturday. He gave up five hits, walked one and struck out four in four innings.

“I knew coming in that I would have to knock the rust off,” Robichaux said. “It’s been a while, but my arm felt a lot better.”

The Cajuns got one back on Seth Harrison’s RBI single in the second, and two innings later, Harrison took a 1-0 pitch from Bobcats starter Austen Williams over the left-field wall for his ninth homer of the year. That scored Adams in front of him to tie the score, and back-to-back doubles by Trahan and Leonards keyed the three-run fifth.

Trey Hicks’ single played Ben McElroy in the sixth to make it a 6-4 game, and Friess’ single came one batter before Studdard’s tying homer. But Trahan reached to lead off the seventh when Bobcats second baseman Matt Smith mishandled a popup in short right field, and Leonards followed with UL-Lafayette’s nation-leading 24th triple of the season off reliever Ross Goebel (2-1).

“We always say that you have to learn how to win in different ways,” Tony Robichaux said. “We go back and forth, and it was almost going to be whoever hit last was going to win.”

The teams will play the middle game of the weekend series at 6:05 p.m. Saturday, with Cajuns junior right-hander Carson Baranik putting his 8-0 record on the line against Texas State junior righty Taylor Black (3-4).