Mr Gregorash quit his role as Customs' chief legal counsel in March this year after more than a decade as a government lawyer.
The lawyer turned whistleblower said: "I've sat on it for a long time. But the story itself is so awful it needs to be told. I think people really need to see what ministers and some senior executives do."
He had decided to speak because he believed the alleged instruction "was unlawful", undermined the way the public service was meant to operate and was given for what was ultimately political reasons.
"The direction came down (from the minister) through the CEO (Carolyn Tremain) and group manager (of legal services) Peter Taylor to me saying 'you don't release anything - I don't care what the OIA says, I'd rather fight it in the courts'."
Mr Gregorash said it was as if ministers were prepared to say: "F*** the OIA, I'd rather fight it through the Ombudsman because it takes three years."
READ MORE: Ombudsman 'appalled' by ex-lawyer's allegations
Mr Gregorash said the alleged instruction came during a briefing from Mr Taylor to the legal team in which he referred to Ms Tremain and meeting with Mr Williamson.
"I resigned over it. I couldn't stare my staff in the face and say this is actually serious conduct that's being presented to you in a lawful way."
Mr Gregorash said the alleged instruction to withhold information was general - but became specific in relation to "sensitive" issues, including entrepreneur Kim Dotcom, wanted for copyright violation in the United States.
"Mr Taylor directed me to withhold all information and pass the same direction on to my team."
He said he was subjected to an internal investigation after releasing information about Dotcom sought by the NZ Herald through the Official Information Act. The information released saw Customs staff discuss earning "brownie points" by passing on Dotcom information to the FBI.
"Simpson Grierson [Dotcom's lawyers] had made several Privacy Act requests of the Government, some of which flowed through Customs, and decisions were made from ministerial level with Maurice Williamson directing Customs, 'Don't you dare release anything - nothing at all.'"
Mr Gregorash said Dotcom's lawyers had sought information from Customs to which he believed Dotcom was entitled. "All sorts of jokes and laughs and cut-downs that were being made by officials to each other were being withheld for [what he considered to be] no reason."
The "brownie points" OIA release to the Herald was the tipping point. "I got dragged over the coals for it. There was an investigation into me. I was cleared. I resigned after that."
Mr Gregorash had a high-level role at Customs, which would have seen him vetted for high security clearance by the Security Intelligence Service. He had worked for a decade as government lawyer, previously with the Environmental Protection Authority and the Ministry of Economic Development.
As a result of the Customs experience, he has not only quit public service but also quit law. Mr Gregorash said the issue was not with Customs but with the influence of politicians on the public service. "The front line staff are really good people with the best of intentions."
Mr Taylor confirmed there was an investigation launched into the decision to release the "brownie points" OIA. "There were issues raised as to 'was it appropriate'." He said there were no issues found with Mr Gregorash's judgment but with Customs' processes.
"It was important to have that independently investigated and it was independently investigated."
He also confirmed he referred to the Minister and Ms Tremain when he briefed the legal team on applying the OIA. "References to the minister and the chief executive may have been made but in the context of making sure we apply the correct principles."
He said he couldn't recall if the minister had concerns about how the act had been applied.
"We have a 'no surprises' policy with ministers and we have to keep ministers well informed of issues that may be raised with the minister and that's extremely important we consult with the minister."
The "no surprises" policy requires departments to tell their ministers when information on which they might be questioned is to be released - but it is not a grounds for withholding information.
Asked what expertise the minister had to contribute to OIA decisions, he said: "We will consult with the minister as appropriate on appropriate Official Information Act requests, yes we will."
Mr Taylor rejected any suggestion there was a ban on releasing Dotcom-related material. Asked if there were different views on what should be released, he said: "There's iterations over how we actually respond to issues and there will be discussions over what's in and what's out. They are appropriate discussions to have until we reach a final decision. We do apply the law appropriately."
Mr Williamson did not return calls or respond to questions about the expertise he added to OIA consideration. In a written statement, he said he was "diligent" in telling ministries "we must meet our legal obligations" under the OIA and Privacy Act. Information should only be withheld "if there were legitimate and legal reasons to do so", he said.
Dotcom's lawyers were in the High Court this week arguing for access to information held by the Government about the entrepreneur, saying there appeared to be "an over-generous use or inappropriate use of the grounds for withholding" from a range of government departments including Customs. It came after the SIS released information to the Herald under the OIA after previously refusing to provide it to Dotcom.
Labour leader David Cunliffe said if Mr Gregorash's claims were true, it would be "completely improper" but would confirm anecdotal reports Labour had heard of similar instances.
"That's why we are committed to a full review of the operations in ministerial offices.
"We want to make sure there's no abuse of power - the kind of thing we saw in the Minister of Justice's office."
Mr Cunliffe noted that the Ombudsman had had to intervene in just the last week to force the Prime Minister's Office to reveal the name of the staffer who former SIS Director Warren Tucker had briefed on plans to release information to WhaleOil blogger Cam Slater.
That staffer was Mr Key's former deputy chief of staff Phil de Joux.