Brace yourself -- 'cause TMZ Sports has obtained photos and video of Joe Riggs' bloody gunshot wound -- taken moments after the UFC star accidentally shot himself in the leg ... and it's gory.

Riggs was supposed to take on Paolo Thiago at UFC Fight Night 51 in Sept. 15th -- but had to be replaced when he shot himself in his upper thigh while cleaning his pistol on July 28th.

You can see in the pics (and the video below) ... the bullet entered the top of his left thigh and exited through the outer thigh -- you can clearly see the entrance and exit wounds.

The UFC says the whole thing was just an "unfortunate accident" that occurred while Joe was cleaning his pistol at his home in AZ -- and says the fighter has the proper permits to own the firearm.