A device for anchoring a prosthetic heart valve or annuloplasty ring to a valve annulus in a heart and a method of implanting same is disclosed. The device can include a prosthetic valve or annuloplasty ring with one or more anchors configured to be threaded or otherwise passed underneath a native leaflet and/or subvalvular tissue to secure the device at the native annulus.