[FOLEY LOGO] FOLEY & LARDNER LLP ATTORNEYS AT LAW 777 EAST WISCONSIN AVENUE, SUITE 3800 MILWAUKEE, WISCONSIN 53202-5306 414.271.2400 TEL 414.297.4900 FAX www.foley.com April 14, 2005 CLIENT/MATTER NUMBER 038584-0115 Whiting Petroleum Corporation 1700 Broadway, Suite 2300 Denver, Colorado 80290-2300 Ladies and Gentlemen: We have acted as counsel for Whiting Petroleum Corporation, a Delaware corporation (the "Company"), in connection with the preparation of a Registration Statement on Form S-3 (Registration No. 333-121615) (the "Registration Statement"), including the prospectus constituting a part thereof, dated January 14, 2005, and the supplement to the prospectus, dated April 14, 2005 (collectively, the "Prospectus"), filed by the Company with the Securities and Exchange Commission under the Securities Act of 1933, as amended (the "Securities Act"), relating to the issuance and sale by the Company of $220,000,000 aggregate principal amount of the Company's [____]% Senior Subordinated Notes due 2013 (the "Notes") in the manner set forth in the Registration Statement and the Prospectus. The Notes will be issued under a Subordinated Indenture (the "Indenture"), between the Company and J.P. Morgan Trust Company, National Association, as Trustee (the "Trustee"), as amended and supplemented by a First Supplemental Indenture (the "Supplemental Indenture"), between the Company and the Trustee, establishing the terms and providing for the issuance of the Notes. The Notes will be fully and unconditionally guaranteed (the "Guarantees") by three of the Company's wholly-owned subsidiaries, Whiting Oil and Gas Corporation, a Delaware corporation, Equity Oil Company, a Colorado corporation and Whiting Programs, Inc., a Delaware corporation (collectively, the "Guarantors"). As counsel to the Company in connection with the proposed issue and sale of the Notes, we have examined: (a) the Registration Statement, including the Prospectus and the exhibits (including those incorporated by reference) constituting a part of the Registration Statement; (b) the Company's Amended and Restated Certificate of Incorporation and Bylaws, each as amended to date; (c) the Indenture and the Supplemental Indenture; (d) the form of the Notes and the Guarantees; and (e) such other proceedings, documents and records as we have deemed necessary to enable us to render this opinion. In our examination of the above-referenced documents, we have assumed the genuineness of all signatures, the authenticity of all documents, certificates and instruments submitted to us as originals and the conformity with the originals of all documents submitted to us as copies. Based upon the foregoing, assuming that each of the Indenture and the Supplemental Indenture, in the form examined by us, (a) will have been executed and delivered by the Company and the Guarantors and (b) will have been duly authorized, executed and delivered by, and represent the valid and binding obligations of, the Trustee, and having regard for such legal considerations as we deem relevant, we are of the opinion that: BOSTON JACKSONVILLE NEW YORK SAN DIEGO/DEL MAR TAMPA BRUSSELS LOS ANGELES ORLANDO SAN FRANCISCO TOKYO CHICAGO MADISON SACRAMENTO SILICON VALLEY WASHINGTON, D.C. DETROIT MILWAUKEE SAN DIEGO TALLAHASSEE WEST PALM BEACH [FOLEY LOGO] Whiting Petroleum Corporation April 14, 2005 Page 2 1. The Company is validly existing as a corporation under the laws of the State of Delaware. 2. The Notes, when executed, authenticated and issued in accordance with the Indenture and the Supplemental Indenture and in the manner and for the consideration contemplated by the Registration Statement and the Prospectus, will be legally issued and valid and binding obligations of the Company enforceable in accordance with their terms, except as enforcement thereof may be limited by bankruptcy or other applicable laws affecting the enforcement of creditors' rights generally or by the application of equitable principles. 3. The Guarantees, when the Notes are executed, authenticated and issued in accordance with the Indenture and the Supplemental Indenture and in the manner and for the consideration contemplated by the Registration Statement and the Prospectus, will be legally issued and valid and binding obligations of the Guarantors enforceable in accordance with their terms, except as enforcement thereof may be limited by bankruptcy or other applicable laws affecting the enforcement of creditors' rights generally or by the application of equitable principles. We hereby consent to the deemed incorporation by reference of this opinion into the Registration Statement and the Prospectus and to the references to our firm therein. In giving this consent, we do not admit that we are "experts" within the meaning of Section 11 of the Securities Act or within the category of persons whose consent is required by Section 7 of the Securities Act. Very truly yours, /s/ Foley & Lardner LLP