Only the first lien or senior lien wipes out subordinate liens.
Now, if the bank foreclosed 3 years ago was the first lien holder and they are the current owner of record and the HOA forecloses on the bank (owner of record) then the bank will lose ownership of the property in the new foreclosure auction.
Note: court auction properties do not convey a free and clear title.
If the HOA foreclosure is against the owner that the bank foreclosed against or a subordinate lien holder then yes it will have an impact against you as the new winning bid.
Before you bid make sure you know the name or names of those being foreclosed on by the HOA and understand your risk.