Exhibit 5.1 COX SMITH MATTHEWS INCORPORATED 112 EAST PECAN STREET SUITE 1800 SAN ANTONIO, TEXAS 78205-1521 (210) 554-5500 FAX (210) 226-8395 www.coxsmith.com Writer's Direct Number Writer's E-Mail Address (210) 554-5255 srjacobs@coxsmith.com December 3, 2004 Abraxas Petroleum Corporation 500 North Loop 1604 East, Suite 100 San Antonio, TX 78232 Re: Registration Statement on Form S-4 filed on December 3, 2004 by Abraxas Petroleum Corporation Ladies and Gentlemen: We have acted as counsel to Abraxas Petroleum Corporation, a Nevada corporation (the "Company"), and its subsidiaries Eastside Coal Company, Inc., a Colorado corporation, Sandia Oil & Gas Corporation, a Texas corporation, Sandia Operating Corp., a Texas corporation, Wamsutter Holdings, Inc., a Wyoming corporation and Western Associated Energy Corporation, a Texas corporation (these subsidiaries, the "Subsidiary Guarantors" and the Company and the Subsidiary Guarantors collectively the "Registrants"), in connection with the Registrants' Registration Statement on Form S-4 filed on December 3, 2004 (the "Registration Statement"), under the Securities Act of 1933, as amended (the "Securities Act"), relating to the Company's offer to exchange (the "Exchange Offer") up to $125,000,000 aggregate principal amount of the Company's Floating Rate Senior Secured Notes due 2009, Series B (the "Exchange Notes"), for a like principal amount of the Company's issued and outstanding Floating Rate Senior Secured Notes due 2009, Series A (the "Old Notes"). The Indenture dated October 28, 2004 (the "Indenture"), by and among the Company, the Subsidiary Guarantors and U.S. Bank National Association, as trustee (the "Trustee"), provides for the guarantee of the Exchange Notes by each of the Subsidiary Guarantors (the "Guarantees") to the extent set forth in the Indenture. The Company is conducting the Exchange Offer to satisfy its obligations under the Exchange and Registration Rights Agreement, dated October 28, 2004 (the "Registration Rights Agreement"), by and among the Company, the Subsidiary Guarantors and Guggenheim Capital Markets, LLC. December 3, 2004 Page2 In our examination, we have assumed the legal capacity of all natural persons, the genuineness of all signatures, the authenticity of all documents submitted to us as originals, the conformity to original documents of all documents submitted to us as facsimile, electronic, or photostatic copies, and the authenticity of the originals of such copies. In making our examination of documents executed or to be executed, we have assumed that the parties thereto had the power, corporate or otherwise, to enter into and perform all obligations thereunder and have also assumed the due authorization by all requisite action, corporate or otherwise, by such parties, and the execution and delivery by such parties of such documents and, except to the extent expressly set forth in our opinion below, the validity and binding effect thereof on such parties. As to any facts material to the opinions expressed herein that we did not independently establish or verify, we have relied upon statements and representations of officers and other representatives of the Company and others and of public officials. We have examined and are familiar with originals or copies, the authenticity of which have been established to our satisfaction, of all such documents, corporate records, certificates of officers of the Company and public officials, and other instruments as we have deemed necessary to express the opinions hereinafter set forth. In expressing our opinions herein, we express no opinion as to compliance with federal and state securities laws. The opinions expressed herein are limited to the laws of the State of Texas and the federal laws of the United States that are normally applicable to transactions of the type contemplated by the Exchange Offer (the "Applicable Law"). The opinions set forth below are subject to the following qualifications, further assumptions and limitations: (a) we do not express any opinion as to the effect on the opinions expressed herein of (i) the compliance or noncompliance of any party to each of the Exchange Notes, the Guarantees, the Indenture and the Registration Rights Agreement with any state, federal or other laws or regulations applicable to it or them or (ii) the legal or regulatory status or the nature of the business of any party; and (b) we do not express any opinion as to the enforceability of the Indenture, the Exchange Notes and the Guarantees. Members of our firm are admitted to the practice of law in the state of Texas and we do not express any opinion as to the laws of any other jurisdiction other than the Applicable Law to the extent referred to specifically herein. Insofar as the opinions expressed herein relate to matters governed by laws December 3, 2004 Page 3 other than the Applicable Law, we have assumed, without having made any independent investigation, that such laws do not affect any of the opinions set forth herein. The opinions expressed herein are based on laws in effect on the date hereof, which laws are subject to change with possible retroactive effect. Based upon the foregoing and subject to the limitations, qualifications, exceptions and assumptions set forth herein, it is our opinion that: (1) the Indenture has been duly authorized, validly executed and delivered by the Company and the Subsidiary Guarantors; (2) the Exchange Notes to be issued and sold as described in the Registration Statement have been duly and validly authorized by the Company for such issuance and sale; (3) the Exchange Notes, when duly executed, issued, sold and delivered by the Company, authenticated by the Trustee in accordance with the provisions of the Indenture and exchanged for the Old Notes, will be duly issued and will constitute valid and binding obligations of the Company enforceable against the Company in accordance with their terms, except to the extent that the enforceability of the Exchange Notes may be limited by bankruptcy, insolvency, moratorium, reorganization, fraudulent conveyance or other laws or decisions relating to or affecting the enforcement of creditors' rights generally and by general principles of equity (regardless of whether such enforceability is considered in a proceeding in equity or at law); (4) each Guarantee has been duly and validly authorized by such Subsidiary Guarantor; and (5) each Guarantee, when executed in accordance with the terms of the Indenture and upon due execution, authentication and delivery of the Exchange Notes in accordance with the Exchange Offer and the Indenture, will be duly issued and will constitute a valid and binding obligation of such Subsidiary Guarantor in accordance with its terms, except to the extent that the enforceability of such Guarantee may be limited by bankruptcy, insolvency, moratorium, reorganization, fraudulent conveyance or other laws or decisions relating to or affecting the enforcement of creditors' rights generally and by general principles of equity (regardless of whether such enforceability is considered in a proceeding in equity or at law). December 3, 2004 Page 4 We hereby consent to the use of our name in the Registration Statement as counsel who has expressed an opinion upon certain legal matters in connection with the issue and sale of the Exchange Notes (including specifically the reference contained under the caption "Legal Matters") and to the filing of this opinion with the Securities and Exchange Commission (the "Commission") as an exhibit to the Registration Statement. In giving this consent, we do not admit that we are within the category of persons whose consent is required under Section 7 of the Securities Act or the general rules and regulations of the Commission promulgated thereunder. Yours very truly, COX SMITH MATTHEWS INCORPORATED By: /s/ Steven R. Jacobs ------------------------------------------------- Steven R. Jacobs For the Firm