The usual sequence is repair, then rebuild if that fails. If that fails too, restore from the most recent backup made before the library was corrupted, and when iPhoto wasn't running. TM doesn't back up the library when iPhoto is running.
Alternatively, you can try to scavenge the library with iPhoto Library Manager independently of iPhoto (). Books, calendars, and slideshows won't be preserved.