<Page>


                                                                     Exhibit 5.1

February 5, 2003

Abraxas Petroleum Corporation
Eastside Coal Company, Inc.
Sandia Oil & Gas Corporation
Sandia Operating Corp.
Wamsutter Holdings, Inc.
Western Associated Energy Corporation
500 North Loop 1604 East
Suite 100
San Antonio, Texas  78232


                  Re: Registration Statement on Form S-1 filed by
                      Abraxas Petroleum Corporation

Dear Sirs:

         We have acted as counsel to Abraxas Petroleum Corporation, a Nevada
corporation ("Abraxas"), Eastside Coal Company, Inc., a Colorado corporation
("Eastside"), Sandia Oil & Gas Corporation, a Texas corporation ("Sandia Oil &
Gas"), Sandia Operating Corporation, a Texas corporation ("Sandia Operating"),
Wamsutter Holdings, Inc., a Wyoming corporation ("Wamsutter"), and Western
Associated Energy Corporation, a Texas corporation ("Western"), in connection
with the registration under the Securities Act of 1933, as amended (the
"Registration Statement"), of an aggregate of $184,000,000 principal amount of
Abraxas' 11-1/2% Secured Notes Due 2007, Series A (the "Notes"), 5,633,291
shares of common stock of Abraxas (the "Common Stock") and the guarantee to be
endorsed on the Notes by Eastside (the "Eastside Guarantee"), Sandia Oil & Gas
(the "Sandia Oil & Gas Guarantee"), Sandia Operating (the "Sandia Operating
Guarantee"), Wamsutter (the "Wamsutter Guarantee") and Western (the "Western
Guarantee").

         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 Abraxas, Eastside,
Sandia Oil & Gas, Sandia Operating, Wamsutter and Western and public officials,
and other instruments as we have deemed necessary to express the opinion
hereinafter set forth. In expressing our opinion as to the valid issuance of the
Notes, Common Stock, Eastside Guarantee, Sandia Oil & Gas Guarantee, Sandia
Operating Guarantee, Wamsutter Guarantee and Western Guarantee we express no
opinion as to compliance with federal and state securities laws.

         Based upon the foregoing, it is our opinion that:

         (1) the Notes to be sold as described in the Registration Statement
have been duly and validly authorized for such sale and, when so sold and
delivered, will be validly issued, fully paid and nonassessable;


<Page>


         (2) the Notes, when sold and delivered, will be binding obligations of
Abraxas except to the extent that the enforceability of the 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);

         (3) the Common Stock to be sold as described in the Registration
Statement has been duly and validly authorized for such sale and, when so sold
and delivered, will be validly issued, fully paid and nonassessable;

         (4) the Eastside Guarantee will be validly issued, fully paid and
nonassessable;

         (5) the Eastside Guarantee will be a binding obligation of Eastside
except to the extent that the enforceability of the Eastside 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;

         (6) the Sandia Oil & Gas Guarantee will be validly issued, fully paid
and nonassessable;

         (7) the Sandia Oil & Gas Guarantee will be a binding obligation of
Sandia Oil & Gas except to the extent that the enforceability of the Sandia Oil
& Gas 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;

         (8) the Sandia Operating Guarantee will be validly issued, fully paid
and nonassessable;

         (9) the Sandia Operating Guarantee will be a binding obligation of
Sandia Operating except to the extent that the enforceability of the Sandia
Operating 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;

         (10) the Wamsutter Guarantee will be validly issued, fully paid and
nonassessable;


<Page>


         (11) the Wamsutter Guarantee will be a binding obligation of Wamsutter
except to the extent that the enforceability of the Wamsutter 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;

         (12) the Western Guarantee will be validly issued, fully paid and
nonassessable; and

         (13) the Western Guarantee will be a binding obligation of Western
except to the extent that the enforceability of the Western 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.

         The opinion expressed herein is limited to the laws of the State of
Texas, the corporation laws of the State of Nevada, and the federal laws of the
United States.

         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 Notes, Common Stock, Eastside Guarantee,
Sandia Oil & Gas Guarantee, Sandia Operating Guarantee, Wamsutter Guarantee and
Western Guarantee (including specifically the reference contained under the
caption "Legal Matters") and to the use of this opinion as an exhibit to
the Registration Statement. In giving this consent, we do not hereby admit
that we are in the category of persons whose consent is required under Section 7
of the Act.

                                            Yours very truly,

                                            COX & SMITH INCORPORATED


                                            By: /s/ Steven R. Jacobs
                                               -------------------------------
                                                Steven R. Jacobs, For the Firm