The Irish twice took the lead through Sean Murray and Alan Sothern before being pegged back by Pakistan.
Almost constant Pakistan pressure was rewarded when Abu Mahmood levelled from a penalty corner to make it 2-2.
Ireland counter-attacked in the 57th minute for O'Donoghue to score the decisive goal from another set-piece.
Earlier, Murray converted a brilliant opener in the 11th minute when he connected with John Jackson's cross and sent a first-time shot into the roof of the net.
Aleem Muhammed Bilal equalised from the penalty-spot in the 17th minute and within 60 seconds of the start of the second half, Alan Sothern made it 2-1 with a first-time deflection.
Mahmood equalised with 14 minutes remaining before O'Donoghue's late winner.
The sides drew 2-2 in Thursday's opening game and will meet again on Sunday (14:00 BST) as the Irish continue their preparations for the World League semi-finals in Johannesburg.
Next month's South African tournament doubles up as the main qualifying tournament for next year's World Cup.
Later this month, Ireland will play against Germany, Spain and Austria at the Hamburg Masters which takes place from 22-25 June.

The royal visit on 7 June will include a look at Europe's most powerful brain scanner, of which there is only one other in the world at Harvard University in the United States.
It will allow scientists to look at how brains work in minute detail.
The Maindy Park building, finished a year ago, will bring together four hi-tech scanners under one roof.
The centre will concentrate on research to hopefully understand more about the causes of conditions like dementia, multiple sclerosis and schizophrenia.
The Connectom scanner is six times more powerful than a conventional hospital MRI scanner and has been described as the "Hubble space telescope of neuroscience".
It will allow researchers to study brain cells only 1000th of a millimetre across.
Using a conventional scanner has been described as looking at a galaxy through a telescope and seeing a blur.
Vice-Chancellor Prof Colin Riordan said the university was "honoured" to welcome The Queen and Duke of Edinburgh to open the centre.
"This will be a fitting occasion for a facility that is not only significant for the university but for Wales, the UK and Europe," he said.
"The research here has the potential to unlock some of the secrets of the brain and significantly contribute towards treatments for neurological and psychiatric conditions."
Prof Derek Jones, centre director, said: "This is the culmination of a huge amount of hard work by many people over several years and I would like to thank everyone who played their part in creating this remarkable facility.
"The combination of the very best staff in their field and some of the most powerful scanners in the world has the potential for breakthroughs that could make a real difference to people's lives around the world."
The royal couple will be invited to view brain imaging procedures and pupils from a local school will take part in activities to illustrate the power of the brain.
A specially-commissioned sculpture created by PhD student Gemma Williams from the University's School of Psychology will also be unveiled.
Cubric will be four times larger than the university's existing brain research imaging facilities.
A late goal by Shane O'Donoghue sealed a 3-2 win for Ireland men's hockey team over Pakistan in the second game of the three-match series at Lisnagarvey.
[NEXT_CONCEPT]
The Queen is to open the new £44m Cardiff University Brain Research Imaging Centre (Cubric) next month.