In what could be the first real test of his year-old government, NSW Premier Barry O’Farrell has been dragged into the casino inquiry and accused of misleading parliament.

Yesterday, as the public inquiry into the February sacking of Star Casino’s former managing director Sid Vaikunta was taking place, BOF was forced to tell parliament that he had not discussed the issues with his chief spin doctor, Peter Grimshaw. Grimshaw worked at Star for 16 years and left to work for O’Farrell after Vaikunta restructured his job.

The inquiry was told about a text Grimshaw sent to his partner on August 21, 2010: “I just told Barry what a dick Sid is … he said we might all have to give Star a wake-up call when I leave.”

All of this is a free kick for opposition leader John Robertson, who this morning called on the Premier to be summonsed to appear before the inquiry and discuss whether he helped pursue Grimshaw’’s personal vendetta against the casino. He also called for Grimshaw, who is currently suspended from his job as BOF’s communications director, to be sacked.

“It’s untenable that somebody clearly out of control with personal rage should be allowed back into the Premier’s office,” Robertson said.

Looming over all of this is the presence of James Packer, who has bought 10% of Star’s corporate parent, Echo Entertainment Group, and is now angling for a board seat. He said yesterday that Star had “pathetic” corporate governance and that he was interested to see whose head would roll from such a “clear breach of the company’s code of conduct”.

The whole saga is starting to look like an episode of Underbelly, as scripted by Quentin Tarantino. Nobody has clean hands, as anyone connected with a casino has at some point lost his or her moral compass.

Governments are also complicit. According to the 2010 Productivity Commission report, state revenue from gambling has risen rapidly over the past two decades, with slightly less than 25% of that coming from casinos. These rivers of cash have had a influence on state governments, particularly here in NSW.

The government regulator, the Independent Liquor and Gaming Authority, is currently conducting a public inquiry into the sacking of Vaikunta, who left after allegedly s-xually harassing two staff members on December 6 and 8 last year. In his opening statement yesterday, counsel assisting Michael Wigney SC, said that about one third of the general allegations raised so far (in an earlier inquiry) — concerning drug taking and the presence of criminals at the casino — have been referred to the police.

Yesterday’s star witness was Grimshaw, who was Star’s media and government relations director for 16 years before becoming O’Farrell’s communications director after the 2011 NSW state election. On March 4, he was stood down pending an investigation into whether he had breached the ministerial code of conduct.

Where it gets complicated is that Grimshaw is the partner of one of the s-xual harassment complainants, who worked in the Star’s HR department. The woman, who cannot be named, was dismissed after returning to work from stress leave for allegedly sharing confidential information.

Star is desperate to show that Grimshaw and his partner have invented these allegations as revenge against Vaikunta, whose restructuring of Grimshaw’s job caused him to leave in a huff. On Sunday the company admitted that to this end, it had leaked damaging texts and emails between the two to The Australian and Daily Telegraph.

Yesterday, Grimshaw was asked about references in the texts to Vaikunta as “Mr Nasty” and a text from his partner that that it was up to him (Grimshaw) to “fix it”. He denied any conspiracy, describing them as “flippant” emails and said that they had been “mucking around”.

On March 7, the NSW Premier accused the Star and Echo of running a ”smear campaign” to “blacken the name of a sexual harassment victim”.

The current inquiry is set down for about a week, and no doubt we will hear more about Grimshaw’s motives and his relationship with the Premier. So far, the  former staffer has strenuously denied using the harassment claim to get even with Vaikunta, saying he was trying to help his partner resolve a serious workplace issue.

What is certain is that no one — Vaikunta, Grimshaw, his partner, the NSW Premier and the executives at Star — could come out of this very well. The hearing continues.