Original: In two-parter "The Best of Both Worlds" Riker takes command of the Enterprise assuming the rank of Captain through a field promotion and orchestrates Picard's rescue.
Simplified: Riker soon becomes very comfortable on the Enterprise, many times refusing offers of his own command. On part 1-2 on the episode "The Best of Both Worlds" Riker takes command on the Enterprise and orders Jean-Luc Picard rescued.