O'Neill, who came off the injured list on Friday after missing 13 games with a right groin strain, hit solo home runs in the second and fifth innings.
O'Neill had been 0 for 4 since being activated until breaking loose. The two-homer game was the second of his career - he connected for pair of two-run homers in a 7-0 win over Pittsburgh on June 15, 2019.
He said the short stint on the injury list helped him regain his confidence.
''I was able to take a little re-set and take a step back and identify what I was doing (wrong),'' O'Neill said. ''I've been doing a lot of work in the cage, doing my due diligence. I wanted to try and stay within the zone and put good swings on good pitches.''
The Reds' skid is their worst since an eight-game slide from March 31-April 7, 2019.
Cincinnati manager David Bell was ejected in the sixth inning. He became upset after Jonathan India was hit on the helmet by a pitch from Flaherty. India stayed in the game to run the bases but was removed after the inning.
Both dugouts were warned. Bell said after the contest that India was OK.
''We'll keep a close eye on him, but I really believe he's fine,'' Bell said.
Jesse Winker homered for the Reds and extended his hitting streak to 10 games, the longest active string in the majors.
Flaherty (4-0) retired the first 10 batters and allowed just three hits in a 95-pitch stint. He struck out six and did not walk a batter.
''I did a lot better job of being able to work ahead,'' Flaherty said. ''Those first pitch strikes set the pace for the whole game.''
Alex Reyes earned his fifth save. He got Tucker Barnhart to ground out with the bases loaded to end the game
O'Neill entered the game 0 for 13 lifetime against Cincinnati starting pitcher Luis Castillo (1-2).
''I was just trying to see a good pitch in the middle of the zone,'' O'Neill said.
Dylan Carlson added three hits and drove in a run. Paul Goldschmidt had two RBIs.
Castillo gave up four runs on six hits over five innings. He struck out three and walked one.
Tyler Naquin added a pinch-hit, RBI single in the Reds eighth.
The Reds have managed just 29 runs during the losing skid.
''We've just got to keep fighting, keep grinding,'' Winker said. ''We're a good ballclub. These things happen throughout a 162-game season.''
Reds: INF Mike Moustakas remains sidelined with a viral infection. He hopes to return sometime during the Reds three-game series that begins on Monday in Los Angeles.
Cardinals: C Yadier Molina missed his second successive game with sore tendon in his right foot. St. Louis manager Mike Shildt says he could have played on Sunday, but the team is taking a cautious approach.
''We don't want to do anything to compromise anything on a long-term basis,'' Shildt said.
Reds: RHP Tyler Mahle (1-1, 1.74) will face Los Angeles Dodgers LHP Julio Urias (3-0, 2.81) on Monday in the first of a three-game set in Los Angeles. Left-handed hitters are just 3 for 43 this season against Mahle with 20 strikeouts this season.
Cardinals: RHP Adam Wainwright (0-2, 5.03) will face Philadelphia RHP Zack Wheeler (1-2, 3.80) on Monday in the first of a four-game set in St. Louis. Wainwright is 7-3 with a 3.10 ERA in 14 lifetime starts against the Phillies.
More AP MLB: https://apnews.com/hub/MLB and https://twitter.com/AP-Sports
Copyright 2021 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.