Exhibit 5.1

April 21, 2026
CECO Environmental Corp.
5080 Spectrum Drive, Suite 800E
Addison, Texas 75001
| Re: | CECO
Environmental Corp. Registration Statement on Form S-4 (File No. 333-294924) |
Ladies and Gentlemen,
We have examined the Registration Statement on Form S-4, File No. 333-294924 (the “Registration Statement”), of CECO Environmental Corp., a Delaware corporation (the “Company”), filed with the Securities and Exchange Commission (the “Commission”) pursuant to the Securities Act of 1933, as amended (the “Securities Act”), in connection with the issuance by the Company of up to 22,635,308 shares of the Company’s common stock, par value $0.01 per share (the “Shares”), pursuant to the Agreement and Plan of Merger, dated as of February 23, 2026 (the “Merger Agreement”), by and among the Company, Thermon Group Holdings, Inc., a Delaware corporation, Longhorn Merger Sub, Inc., a Delaware corporation and a direct wholly-owned subsidiary of the Company, and Longhorn Merger Sub LLC, a Delaware limited liability company and a direct wholly-owned subsidiary of the Company.
In arriving at the opinion expressed below, we have examined originals, or copies certified or otherwise identified to our satisfaction as being true and complete copies of the originals, of the Merger Agreement and such other documents, corporate records, certificates of officers of the Company and of public officials and other instruments as we have deemed necessary or advisable to enable us to render the opinion set forth below. In our examination, we have assumed without independent investigation the genuineness of all signatures, the legal capacity and competency of all natural persons, the authenticity of all documents submitted to us as originals and the conformity to original documents of all documents submitted to us as copies.
Based upon the foregoing, and subject to the assumptions, exceptions, qualifications and limitations set forth herein, we are of the opinion that the Shares, when issued in accordance with the terms, and subject to the satisfaction of the conditions, set forth in the Merger Agreement and in the manner contemplated by the Registration Statement, will be validly issued, fully paid and non-assessable.
We render no opinion herein as to matters involving the laws of any jurisdiction other than the Delaware General Corporation Law (the “DGCL”). This opinion is limited to the effect of the current state of the DGCL and the facts as they currently exist. We assume no obligation to revise or supplement this opinion in the event of future changes in such law or the interpretations thereof or such facts.
Gibson, Dunn &
Crutcher LLP
2001 Ross Avenue, Suite 2100 | Dallas, TX 75201-2923 | T: 214-698-3100 | gibsondunn.com
April 21, 2026
Page 2
We consent to the filing of this opinion as an exhibit to the Registration Statement, and we further consent to the use of our name under the caption “Legal Matters” in the Registration Statement and the prospectus that forms a part thereof. In giving these consents, we do not thereby admit that we are within the category of persons whose consent is required under Section 7 of the Securities Act or the rules and regulations of the Commission.
Very truly yours,
/s/ Gibson, Dunn & Crutcher LLP