Charles C. Gilbert was a captain in the 1st US Infantry. After the wounding of "Bull" Nelson in the Battle of Richmond, KY, the commander of the Department of the Ohio, Horatio Wright, appointed Gilbert a temporary major general to fill Nelson's place. Lincoln appointed Gilbert a brigadier general of volunteers in September, 1862. In these ranks (and wearing two stars), Gilbert commanded a corps under Buell at Perryville (where his troops remained inactive with the battle raging a short distance away).
The Senate failed to confirm Gilbert's appointment, and he returned to the regular army at the rank of major.
So it's a hard call as to whether Gilbert meets your criteria. He was appointed from captain to general, but not confirmed in that rank. He served as a general from September, 1862 through March, 1863.
Even saying he was promoted from captain to general is ambiguous. He had been breveted to major after Shiloh. So his permanent rank was captain when he was promoted to general.