Yes, it very well may be the best thing:
“If a person who has been exposed to Hepatitis B virus gets the Hepatitis B vaccine and/or a shot called HBIG (Hepatitis B immune globulin) within 24 hours, Hepatitis B infection may be prevented.”
http://www.cdc.gov/hepatitis/B/bFAQ.htm#transmission
How does that work? If you have the real disease, your immune system will already be making antibodies. What good is injecting an attenuated version going to do?