Hanley Ramirez was in a familiar position in the sixth inning Friday. The look on his face said he was hurt, but none of the 30,818 spectators at Petco Park could be sure what happened, or how. It seemed Ramirez was not quite healthy enough to play and not quite hurt enough to come out of the game — his season in a nutshell. After a chat with his manager and a brief jog up the line, Ramirez was allowed to play another two innings. It turned out to be the correct decision for the Dodgers. Ramirez hit a game-tying solo home run in the eighth inning before the Dodgers lost in the 12th, 3-2. The game ended when San Diego’s Yasmani Grandal singled off Dodgers pitcher Kevin Correia (2-2) with two outs and the bases loaded, driving in Yangervis Solarte with the game-winning run. The climactic ending came after the Dodgers nearly turned an inning-ending double play with four players — Miguel Rojas, Dee Gordon, Adrian Gonzalez and Andre Ethier — stationed on the right side of the infield. The situation was dire. The Padres had loaded the bases with one out. The batter, Seth Smith, is a notorious pull hitter. The Dodgers routinely station three defenders on the right side against Smith, “so it’s like we might as well put them all on that side,” manager Don Mattingly said. Smith beat out a bases-loaded ground ball hit to Gordon, who relayed home to catcher A.J. Ellis to retire the lead runner. Ellis threw late to Ethier covering first base. “I’ve never seen ‘em all over there,” Mattingly confessed after the game. Ramirez’s situation was a familiar one. The veteran shortstop strained his right oblique muscle on Aug. 9 and spent the next 15 days on the disabled list. Friday’s game was his fourth since being activated.