EX-5.1 2 a2198003zex-5_1.htm EXHIBIT 5.1
QuickLinks -- Click here to rapidly navigate through this document


Exhibit 5.1

April 12, 2010

VIA OVERNIGHT DELIVERY

Board of Directors
Heritage Oaks Bancorp
545 12th Street.,
Paso Robles, CA 93446

    Re:    Registration Statement on Form S-3

Ladies and Gentlemen:

        At your request, we have examined the Registration Statement on Form S-3 (the "Registration Statement") being filed by Heritage Oaks Bancorp (the "Company") with the Securities & Exchange Commission in connection with the registration under the Securities Act of 1933 of (a) shares of Mandatorily Convertible Cumulative Adjustable Rate Perpetual Preferred Stock, Series B, no par value (the "Series B Preferred Stock") and the shares of Common Stock, no par value (the "Common Stock"), underlying such shares; (b) shares of Convertible Perpetual Preferred Stock, Series C, no par value (the "Series C Preferred Stock" and, with the Series B Preferred Stock, the "Preferred Stock") and the shares of Common Stock underlying such shares; and (c) any additional shares of Common Stock or Preferred Stock that become issuable in connection with anti-dilution adjustments as set forth in the terms of the Preferred Stock (collectively, the "Securities").

        In rendering this opinion, we have examined such documents and records as we have deemed relevant. We have assumed the genuineness of all signatures, the authenticity of all documents submitted to us as originals and the conformity to originals of all documents submitted to us as certified or reproduced copies. In addition, we have assumed that (i) the Registration Statement, and any amendments thereto (including post-effective amendments), will have become effective under the Act; (ii) a prospectus supplement will have been prepared and filed with the Securities and Exchange Commission describing the Securities offered thereby; (iii) all Securities will be issued and sold in compliance with applicable federal and state securities laws and in the manner stated in the Registration Statement and the applicable prospectus supplement; (iv) a definitive purchase, underwriting or similar agreement with respect to any Securities offered will have been duly authorized and validly executed and delivered by the Company and the other parties thereto; (v) any Securities issuable upon conversion, exchange, redemption or exercise of any Securities being offered will be duly authorized, created and, if appropriate, reserved for issuance upon such conversion, exchange, redemption or exercise; and (vi) with respect to shares of Common Stock or Preferred Stock offered, there will be sufficient shares of Common Stock or Preferred Stock authorized under the Company's Articles of Incorporation and the Company's Bylaws and not otherwise reserved for issuance.

        Based upon the foregoing and such other further review of fact and law as we have deemed necessary or appropriate under the circumstances, we are of the opinion that any Securities consisting of Common Stock or Preferred Stock, when issued and delivered against payment therefore, will be duly and validly issued, fully paid and non-assessable.

        This opinion is issued to you solely for use in connection with the Registration Statement and is not to be quoted or otherwise referred to in any financial statements of the Company or related documents, nor is it to be filed with or furnished to any government agency or other person, without the prior written consent of this firm in each instance.


Board of Directors
Heritage Oaks Bancorp
April 12, 2010
Page 2

        This firm hereby consents to the filing of this opinion as an exhibit to the Registration Statement and to the reference to the undersigned under the heading "Legal Matters" therein and in the related prospectus. In giving such consent, we do not hereby admit that we are in 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,



 

 

STUART -- MOORE



QuickLinks