The one good thing Poe can see about this situation is that the freighter that locked onto him, disabled his weapon systems, and pulled him into its cargo bay doesn't seem to be First Order. Really, it's less good than "not as bad, maybe". The First Order would definitely kill him; pirates might kill him, or try to ransom him, or, if they're feeling charitable, might just take everything of value he has and then dump him on the nearest world. The nearest world hospitable to humans, if they're feeling particularly charitable.
The right hook he gets from the first one to enter the cargo bay, when he hasn't even done anything to deserve getting punched, suggests they aren't.
Two of them subdue him and start to march him out of the cargo bay while others swarm over his X-Wing. BB-8 trills in distress, and Poe shouts "Everything's gonna be fine, buddy," over his shoulder and hopes it's not a lie.
After an unproductive and occasionally painful conversation on the command deck, Poe ends up shoved into a corner with binders on his wrists while the captain and first mate debate what to do with him. From what he's seen, there's a crew of at least ten, with a mix of species--human, Weequay, at least one Rodian. He doesn't doubt they're all willing to kill him, though that doesn't seem to be their first choice. Four of them are in the room with him right now, all armed.
As it stands, Poe doesn't see a way of getting out of this on his own, but he stays alert just in case something shifts in his favor.
"Captain?" Someone says over the ship's comms. "We, uh--we ran into a slight problem with the prisoner's droid."
"What problem?" the captain replies impatiently. "Did you put it in the hold like I said?"
"That's just it, sir. We were doing that, and then it, ah...it got loose and locked us in."
Poe can't help the grin that breaks out on his face. The captain's eyes narrow. "It locked you in?"
"It overrode the door controls!" the pirate on the comms protests. "We're working on getting out, but we thought we should let you know the little skug's loose on the ship."
"Fine," the captain grumbles, and then raises his voice. "All hands, be on the lookout for an orange and white BB unit. Subdue on sight."
A minute later, a new voice comes over the comms. "I got 'im, Captain--ow! What the--" There's a zzt and a yell of pain. "Little bugger attacked me!"
"Attacked you?" the captain echoes incredulously. "It's an astromech, not a battle droid!"
"Tell that to the droid! Now it's run off again, blast it--"
Poe's smiling again, until the captain looks at him and he quickly changes the look to one of subdued concern. The captain stalks over, bending down to glare in his face.
"In case it doesn't go without saying--the more trouble your droid causes my crew, the worse things are going to be for you."
Poe lifts his bound hands defensively. "Hey, don't look at me. Droid's got a mind of its own."
Fifteen minutes later, after BB-8 has attacked at least two more pirates--setting one's trouser leg on fire and bowling another over going down a corridor at ramming speed--and managed to hide somewhere in the ship's inner workings, the first mate grabs Poe by the lapels and hauls him over to a console.
"You're its master, right?" the captain tells him through clenched teeth. "So talk it down, unless you want us to blast it into a million pieces when we catch it."
"Okay, okay," Poe says, and leans forward. "BB-8, wherever you are right now, I hope you can hear me." What he does next is probably not smart, but damned if it isn't satisfying. Locking eyes with the captain, he smiles so wide it makes his split lip throb. "Give 'em hell, buddy."
The first mate slams him forward into the console and then back against the wall. Poe's vision swims briefly, and when it clears there's a blaster pointed at his face.
"Enough of this," the captain snarls. "Droid, if you want your master to stay alive, give yourself up."
That's when the ship's gravity switches off.
The captain is unprepared, whereas Poe has been braced for something to happen, even if it wasn't precisely this. As everything and everyone that's not bolted down starts floating, he plants a foot against the wall behind him and launches himself at the captain, wrestling the blaster away from him and spinning them so that he's on top.
"Turn it back on, BB-8!" he shouts, and they crash back to the deck.
"Someone kriffing shoot him!" the captain shouts, and Poe jams the blaster against the back of his head.
"Yeah, not such a good idea."
The captain lets out a string of curses mixed with dire threats, only to be interrupted a moment later by the pirate at the helm.
"Sir, I can't--" she looks up from the controls, confused and angry. "We've lost all control of the ship! Every system's been overridden."
"How the hell did one little droid do that?" the first mate asks.
"It's not the droid!" The helmswoman stares incredulously at her display. "It's the ship's computer! Whatever command I put in, it just keeps saying the same thing over and over."
"Well, what's it saying?" the captain demands.
"That...that we should give BB-8's pilot back and let them go unharmed, sir."
The captain yells and curses some more, and it's the first mate who interrupts him this time. "Let's just do it! Whatever profit we could turn from them, it's not worth this."
BB-8 meets Poe in the cargo bay, beeping happily and rolling excited circles around him. Poe wants to get out of here before the pirates change their minds, but he pauses to crouch and put a hand on the droid's head.
"Thank you. Come on, we gotta go."
He punches the throttle as soon as they're clear of the pirate ship, BB-8's continued chatter filling his comms.
"You did so well back there, buddy," Poe says. "You saved me! And we're gonna have a hell of a story to tell when we get back to base." Speaking of which--" He grins, setting the coordinates on his navicomputer. "Let's go home."