The following explains it. From the sounds of yours it may have been unplayable. In that case you lift the ball, take a penalty stroke and drop the ball in the bunker. I have lost balls in lips of bunkers, quite a bad break....
Here is the USGA site for that rule:
USGA: Rules and Decisions
Here is an excerp:
a. Searching for or Identifying Ball Covered by Sand
If the player’s ball lying anywhere on the course is believed to be covered by sand, to the extent that he cannot find or identify it, he may, without penalty, touch or move the sand in order to find or identify the ball. If the ball is found, and identified as his, the player must re-create the lie as nearly as possible by replacing the sand. If the ball is moved during the touching or moving of sand while searching for or identifying the ball, there is no penalty; the ball must be replaced and the lie re-created.
In re-creating a lie under this Rule, the player is permitted to leave a small part of the ball visible.