Davis replaced Herrera with two on in the seventh inning and walked Jose Abreu to load the bases for Gillaspie, who cleared them with a triple to right-center on a 2-2 pitch to give Chicago a 7-5 lead.
That ended Herrera's scoreless streak at 30 2/3 innings, dating to June 24. Also snapped was Davis' shutout streak of 31 2/3 innings, a club record for a reliever, with the first run charged to him since June 25.
"I felt comfortable and confident the whole time," Davis said. "I just didn't make the pitches I needed to make to keep the game where it was, and it ended up costing us some runs.
"We've thrown well as of late, but tonight we didn't get the job done and it was unfortunate."
The rare bullpen failure prevented Kansas City from gaining ground on AL Central leader Detroit, which lost at Minnesota. The Royals remained 1 1/2 games behind the Tigers, but still lead Seattle for the second wild-card spot.
"Guys make mistakes," Gillaspie said. "You have to be able to take advantage. Truthfully, I don't wish having to face them on anybody. They are the best relievers in baseball. I honestly feel that their stuff is nasty, the whole staff and a filthy bullpen. I got a big hit and helped us win a game. When you are facing guys like this, if you take a pitch off, you're out. If you're not in focus every single pitch you might as well walk back to the dugout."
Kansas City used nine pitchers, a club record for a nine-inning game, in a contest that lasted 4 hours, 16 minutes -- the longest nine-inning game in Royals history.
Nori Aoki had his second straight four-hit game, including a sixth-inning single that put the Royals up 5-4, but this time the bullpen couldn't hold it.
Adam Eaton had four hits, matching his career high, and scored two runs for Chicago.
"That doesn't happen very often," Eaton said about beating the Royals' bullpen.
Kansas City manager Ned Yost went to his bullpen early when starter Liam Hendriks was pulled after three-plus innings. He gave up four runs on seven hits and a walk.
"I'm very disappointed in the way I pitched," Hendriks said.
In his past three outings, Hendriks has allowed 11 runs and 18 hits in 9 1/3 innings.
White Sox rookie right-hander Chris Bassitt also failed to make it out of the fourth. He threw 94 pitches in 3 2/3 innings, allowing three runs on six hits and four walks.
Royals catcher Salvador Perez walked in the second inning, his first free pass since Aug. 12. He went 122 plate appearances without a walk.
White Sox: DH-1B Paul Konerko, who has not played since breaking his left hand on Sept. 2, took extended batting practice. "When he's fit to play, he'll get some time," manager Robin Ventura said. "I don't necessarily want him going out there not having swung a bat in two weeks. He'll get an at-bat here or there to acclimate him."
Royals: LHP Danny Duffy, who skipped two starts because of a sore shoulder, threw a four-inning simulated game. "There's nothing wrong," Duffy said. "I felt stronger than I did for about the past month." He is slated to start Monday in Cleveland.
White Sox: LHP Chris Sale, an AL Cy Young Award contender, starts the series finale. He has trouble with Royals DH Billy Butler, who has a .359 career average against him with three home runs, two doubles and 10 RBIs in 39 at-bats.
Royals: RHP Yordano Ventura has nine made consecutive quality starts, a club record for rookies.