"I will be happy if my quitting the post helps solve this issue," Mr Gilani said while interacting with a group of reporters at his residence in Lahore yesterday.
He referred to a "third option" - resigning from the post of premier - when asked about the Supreme Court's ultimatum to reopen the cases against Mr Zardari or facing imprisonment for committing contempt of court.
"I am ready for the third option if the matter is resolved. But after my going, a new Prime Minister will have to face the same dilemma," he said.
Over the past few days, Mr Gilani has said he will not write a letter to the Swiss authorities to revive the cases against Mr Zardari as the President enjoys immunity from prosecution under the Constitution.
The premier has also said he would prefer to be jailed for contempt rather than violate the Constitution by acting on the apex courts orders to reopen the graft cases.
The Supreme Court has set Mar 21 as the deadline for Mr Gilani to approach the Swiss authorities. The apex court will resume hearing a contempt case against the premier on the same day.
During the interaction with the journalists, Mr Gilani said the issue of the President's immunity should be referred to the Parliament just like the issue of the appointment of judges.
"I cannot waive the immunity. Even the President cannot do it. The President has absolute immunity even under international laws," he said.
"The Constitution grants immunity to the office of the President, who is part and parcel of the Parliament. Therefore, the supreme legislative body is the best forum to deal with issues related to presidential immunity," he said.
Mr Gilani described as wrong the impression that his Pakistan People's Party was behind the case of the funding of politicians by the Inter-Services Intelligence agency that is being heard by the Supreme Court.
"The judiciary has taken up the matter and will take it to its logical end," he said.
The Pakistan Prime Minister also criticised the government's critics, especially the PML-N, for remaining silent on this issue for 16 years.
"Why did they remain silent for 16 or so years. They could have gone to the court to clear their names," he said.