As a player for Cork on the inter-county scene O’Leary carved out a reputation for himself as a deadly goal-poacher who could seemingly produce a goal out of nothing. He first came to prominence in 1969 when he won a Munster title at minor level. O’Leary later captured an All-Ireland minor medal following a defeat of Kilkenny in the championship decider. 1970 saw O’Leary repeat this feat by adding a second consecutive set of Munster and All-Ireland minor medals to his collection. He also pulled off a unique double that year by winning an All-Ireland medal at under-21 level. O’Leary captured a first Munster under-21 title in 1971, before adding a second All-Ireland under-21 medal to his collection. The success continued in 1973 when he won a second Munster medal and a third All-Ireland medal at under-21 level.
By this stage O'Leary had made his debut on the Cork senior hurling team. In 1972 he claimed his first National Hurling League title, before winning his first senior Munster medal later that same summer. Cork reached the All-Ireland final that year but were eventually defeated by Kilkenny one of the classic games of the modern era. Cork's fortunes in the Munster Championship took a downturn for the next few years, however, O'Leary secured a second National League title in 1974. In 1975 he won a second Munster title at senior level, however, Cork were beaten by Galway in the All-Ireland semi-final. The following year O’Leary won a third provincial title, a victory which allowed Cork to advance directly to the All-Ireland final. ‘The Rebels’ faced a nightmare start as Wexford scored two goals in the first eight minutes. Cork quickly settled into the game and defeated the men from the Model County on a score line of 2-21 to 4-11, giving O’Leary his first senior All-Ireland title. His performance throughout the championship earned the Youghal-man an All-Star award for his excellent displays at corner-forward.
In 1977 O’Leary captured a fourth Munster title and Cork qualified for a second consecutive All-Ireland final showdown with Wexford. Before the game had even started, however, O'Leary injured himself. During a pre-match warm-up in front of Hill 16 he got hit in the face with a sliothar, suffering a broken nose. He missed the parade before the game due to his injury but played for the full 70 minutes, being described throughout the game by RTÉ commentator Michael O'Hehir as "the man who nearly didn't play." In spite of this injury O’Leary collected a second All-Ireland medal that day and later he won a second All-Star. 1978 saw O’Leary add a fifth provincial medal to his collection. It was a special year for Cork hurling as the team later defeated Kilkenny in the championship decider, giving O’Leary a third All-Ireland medal in-a-row. In 1979 he won a fifth consecutive Munster medal, his sixth in all, however, Cork were caught on the hop by Galway in the All-Ireland semi-final once again. Cork’s championship form took a downturn for the next two seasons, however, O’Leary won back-to-back National League medals in 1980 and 1981 bringing his overall tally to four.
Cork were back on form again in 1982 with O'Leary winning his seventh Munster title, however, Kilkenny were the victors in the All-Ireland final. O'Leary won his eighth Munster medal in 1983 but once again the All-Ireland title went to the men from Kilkenny. In the 1984 Munster final against Tipperary he gave his most outstanding display as a hurler. Cork were trailing Tipp by four points with four minutes to go when O'Leary and Tony O'Sullivan scored two quick goals to clinch victory for Cork. Having suffered defeat in the two previous All-Ireland final Cork made no mistake in disposing of Offaly in a very special All-Ireland final at Semple Stadium in Thurles. It was O'Leary's fourth All-Ireland medal and his last game for Cork. He was once again honoured with a third and final All-Star award.