"Invalid API identifier specified"

Sounds like an API Gateway error. Have you tried checking the API Gateway to see if there are some API Gateway resources referencing the function you originally deleted?