win 3–1. O'Keefe's performances saw him establish himself in the first team and his attitude to being left out of the team for long periods drew praise from Cardiff manager Russell Slade who commented "Stuart has got a fantastic attitude, he's a real, real good professional, even when he wasn't in the side he was pushing. [...] some players when they're not in the side get disillusioned and want to move on, but not O'Keefe." He later scored his first goal for the club in a 2–0 victory during a Severnside derby match against Bristol City on 5 March 2016, adding his second one-month later with the winning goal during a 2–1 win over Derby County on 2 April. He finished the season having made 27 appearances for the club in all competitions, the most appearances he has made during a season to date and the first time in his career he made over 20 appearances in a single season. His impressive form during the second half of the 2015–16 season saw him handed a new contract during the summer, keeping him at Cardiff until summer 2019. After featuring as an unused substitute during the first match of the 2016–17 season, O'Keefe was handed his first appearance of the season in a 1–0 defeat to Bristol Rovers in the first round of the EFL Cup, where he suffered a broken arm in extra-time. He made his return to the team one month later on 25 September, helping Cardiff to their second win of the season during a 2–1 win against Rotherham United. However, with first-team opportunities limited at Cardiff, on 31 January 2017, O'Keefe joined League One club Milton Keynes Dons on loan until 1 May 2017, making his debut for the club as a substitute in place of Chuks Aneke during a 1–1 draw with Bolton Wanderers on 4 February 2017. He made a total of 18 appearances during the loan spell, scoring four times. On 31 August 2017, O'Keefe joined League One club Portsmouth on loan until the end of the 2017–18 season. At the start of the following season, O'Keefe was sent out on loan for the second successive season, joining Plymouth Argyle. He returned to Cardiff in January 2019, but was released later that year. Gillingham O'Keefe signed for League One club Gillingham on 11 June 2019. He scored his first goal for Gillingham when he